Skip to content

Commit a6648bf

Browse files
authored
Merge pull request #6163 from IgniteUI/apetrov/new-desing-system-samples
docs(styling): add text for new bespoke design system samples
2 parents 85dcc71 + dfa2ac6 commit a6648bf

File tree

8 files changed

+194
-54
lines changed

8 files changed

+194
-54
lines changed

en/components/button.md

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,25 @@ If all went well, you should see something like the following in the browser:
249249

250250
## Styling
251251

252-
To get started with styling the button, we need to import the `index` file, where all the theme functions and component mixins live:
252+
Following the simplest approach, you can use CSS variables to customize the appearance of the button:
253+
254+
```css
255+
[igxButton] {
256+
--background: #ff4d4f;
257+
--hover-background: #ff7875;
258+
--active-background: #d9363e;
259+
--focus-visible-background: #ff4d4f;
260+
--focus-visible-foreground: #fff;
261+
}
262+
```
263+
264+
By changing the values of these CSS variables, you can alter the entire look of the button.
265+
266+
<div class="divider--half"></div>
267+
268+
Another way to style the button is by using **Sass**, along with our [`button-theme`]({environment:sassApiUrl}/index.html#function-button-theme) function.
269+
270+
To start styling the button using **Sass**, first import the `index` file, which includes all theme functions and component mixins:
253271

254272
```scss
255273
@use "igniteui-angular/theming" as *;
@@ -268,27 +286,27 @@ Given the following markup:
268286
</div>
269287
```
270288

271-
We need to create a theme:
289+
We need to create the following theme:
272290

273291
```scss
274292
$custom-button-theme: button-theme(
275-
$foreground: #fdfdfd,
276-
$hover-foreground: #fdfdfd,
277-
$focus-foreground: #fdfdfd,
278-
$background: #345779,
279-
$hover-background: #2e4d6b,
280-
$focus-background: #2e4d6b,
281-
$disabled-foreground: #2e4d6b,
293+
$foreground: #fdfdfd,
294+
$hover-foreground: #fdfdfd,
295+
$focus-foreground: #fdfdfd,
296+
$background: #345779,
297+
$hover-background: #2e4d6b,
298+
$focus-background: #2e4d6b,
299+
$disabled-foreground: #2e4d6b,
282300
);
283301
```
284302

285303
Take a look at the [`button-theme`]({environment:sassApiUrl}/themes#function-button-theme) section for a complete list of available parameters for styling any type of button.
286304

287-
The last step is to pass the custom button theme in our application:
305+
Finally, **include** the custom theme in your application:
288306

289307
```scss
290308
.button-sample {
291-
@include css-vars($custom-button-theme);
309+
@include css-vars($custom-button-theme);
292310
}
293311
```
294312

@@ -310,22 +328,25 @@ If you want to style only the `contained` button, you can use the [`contained-bu
310328

311329
```scss
312330
$custom-contained-theme: contained-button-theme(
313-
$background: #348ae0,
331+
$background: #348ae0,
314332
);
315333
```
316334

317335
With the new type-specific theme functions, styling buttons is now easier. For [`contained-button-theme`]({environment:sassApiUrl}/themes#function-contained-button-theme) and [`fab-button-theme`]({environment:sassApiUrl}/themes#function-fab-button-theme) functions (as shown in the example above), you only need to provide a color to the `$background` parameter. All other button state and text colors will then be automatically generated and applied based on that value. The text color is determined by the newly added [`adaptive-contrast`]({environment:sassApiUrl}/color#function-adaptive-contrast) function, which calculates whether black or white provides better contrast against the supplied background color.
318336

319337
For [`flat-button-theme`]({environment:sassApiUrl}/themes#function-flat-button-theme) and [`outlined-button-theme`]({environment:sassApiUrl}/themes#function-outlined-button-theme) functions, the button state colors are also automatically generated and applied, but they are derived from the supplied `$foreground` parameter instead of `$background`.
320338

321-
### Demo
339+
In the sample below, you can see how using the button component with customized CSS variables allows you to create a design that visually resembles the button used in the [`Ant`](https://ant.design/components/button?theme=light#button-demo-color-variant) design system.
322340

323-
<code-view style="height: 100px"
341+
<code-view style="height: 260px"
324342
no-theming
325343
data-demos-base-url="{environment:demosBaseUrl}"
326344
iframe-src="{environment:demosBaseUrl}/data-entries/buttons-style/" >
327345
</code-view>
328346

347+
> [!NOTE]
348+
> The sample uses the [Bootstrap Light](themes/sass/schemas.md#predefined-schemas) schema.
349+
329350
### Custom sizing
330351

331352
You can change the button height either by using the `--size` variable, targeting the `button` directly:

en/components/calendar.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,14 @@ The last step is to pass the custom calendar theme:
480480
@include css-vars($custom-calendar-theme);
481481
```
482482

483-
<code-view style="height:500px"
483+
In the sample below, you can see how using the calendar with customized CSS variables allows you to create a design that visually resembles the calendar used in the [`SAP UI5`](https://ui5.sap.com/#/entity/sap.ui.unified.Calendar/sample/sap.ui.unified.sample.CalendarSingleDaySelection) design system.
484+
485+
<code-view style="height:350px"
484486
no-theming
485487
data-demos-base-url="{environment:demosBaseUrl}"
486488
iframe-src="{environment:demosBaseUrl}/scheduling/calendar-styling-sample/" >
487489
</code-view>
488490

489-
490491
## API References
491492
<div class="divider--half"></div>
492493

en/components/card.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,41 +328,58 @@ You can justify the buttons so that they are laid out across the entire axis, no
328328
```
329329

330330
## Styling
331-
To get started with styling the card, we need to import the `index` file, where all the theme functions and component mixins live:
331+
332+
Following the simplest approach, you can use CSS variables to customize the appearance of the card:
333+
334+
```css
335+
igx-card {
336+
--border-radius: 8px;
337+
--outline-color: #f0f0f0;
338+
--background: #bfbfbf;
339+
--header-text-color: #000;
340+
}
341+
```
342+
343+
By changing the values of these CSS variables, you can alter the entire look of the card component.
344+
345+
<div class="divider--half"></div>
346+
347+
Another way to style the card is by using **Sass**, along with our [`card-theme`]({environment:sassApiUrl}/index.html#function-card-theme) function.
348+
349+
To start styling the card using **Sass**, first import the `index` file, which includes all theme functions and component mixins:
332350

333351
```scss
334352
@use "igniteui-angular/theming" as *;
335353

336354
// IMPORTANT: Prior to Ignite UI for Angular version 13 use:
337355
// @import '~igniteui-angular/lib/core/styles/themes/index';
338356
```
357+
339358
Following the simplest approach, we create a new theme that extends the [`card-theme`]({environment:sassApiUrl}/themes#function-card-theme) and providing just a few styling parameters. If you only specify the `$background` parameter, the appropriate foreground colors will be automatically chosen, either black or white, based on which offers better contrast with the background.
340359

341360
```scss
342-
$colorful-card: card-theme(
343-
$background: #011627,
344-
$subtitle-text-color: #ecaa53,
361+
$custom-card-theme: card-theme(
362+
$background: #011627,
363+
$subtitle-text-color: #ecaa53,
345364
);
346365
```
347-
As seen, the `card-theme` exposes some useful parameters for basic styling of its items.
348366

349-
The last step is to **include** the component theme in our application.
367+
Finally, **include** the custom theme in your application:
350368

351369
```scss
352-
@include css-vars($colorful-card);
370+
@include css-vars($custom-card-theme);
353371
```
354372

355-
### Angular Card Demo
373+
In the sample below, you can see how using the card component with customized CSS variables allows you to create a design that visually resembles the card used in the [`Ant`](https://ant.design/components/card?theme=light#card-demo-meta) design system.
356374

357-
358-
<code-view style="height: 486px"
375+
<code-view style="height: 400px"
359376
no-theming
360377
data-demos-base-url="{environment:demosBaseUrl}"
361378
iframe-src="{environment:demosBaseUrl}/layouts/card-styling-sample/" >
362379
</code-view>
363380

364-
365381
### Summary
382+
366383
In this article we covered a lot of ground with the card component. First, we created a very simple card with text content only. Then added some images to make the card a bit more appealing. We used some additional Ignite UI for Angular components inside our card, avatar, buttons and icons, to enrich the experience and add some functionality. And finally, we changed the card's theme by setting some exposed theme colors, creating custom palettes and extending schemas.
367384
The card component is capable of displaying more different layouts worth exploring in the Card Demo in the beginning of this article.
368385

en/components/checkbox.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,31 @@ After all that is done, our application should look like this:
211211

212212
## Styling
213213

214-
To get started with styling the checkbox, we need to import the `index` file, where all the theme functions and component mixins live:
214+
Following the simplest approach, you can use CSS variables to customize the appearance of the checkbox:
215+
216+
```css
217+
igx-checkbox {
218+
--tick-color: #0064d9;
219+
--tick-color-hover: #e3f0ff;
220+
--fill-color: transparent;
221+
--fill-color-hover: #e3f0ff;
222+
--label-color: #131e29;
223+
--focus-outline-color: #0032a5;
224+
--border-radius: 0.25rem;
225+
}
226+
227+
igx-checkbox:hover {
228+
--empty-fill-color: #e3f0ff;
229+
}
230+
```
231+
232+
By changing the values of these CSS variables, you can alter the entire look of the checkbox component.
233+
234+
<div class="divider--half"></div>
235+
236+
Another way to style the checkbox is by using **Sass**, along with our [`checkbox-theme`]({environment:sassApiUrl}/index.html#function-checkbox-theme) function.
237+
238+
To start styling the checkbox using **Sass**, first import the `index` file, which includes all theme functions and component mixins:
215239

216240
```scss
217241
@use "igniteui-angular/theming" as *;
@@ -225,27 +249,28 @@ Then, we create a new theme that extends the [`checkbox-theme`]({environment:sas
225249
```scss
226250
// in styles.scss
227251
$custom-checkbox-theme: checkbox-theme(
228-
$empty-color: #ecaa53,
229-
$fill-color: #ecaa53,
230-
$border-radius: 5px
252+
$empty-color: #ecaa53,
253+
$fill-color: #ecaa53,
254+
$border-radius: 5px
231255
);
232256
```
233257

234-
The last step is to **include** the component theme in our application.
258+
Finally, **include** the custom theme in your application:
235259

236260
```scss
237261
@include css-vars($custom-checkbox-theme);
238262
```
239263

240-
### Demo
241-
264+
In the sample below, you can see how using the checkbox component with customized CSS variables allows you to create a design that visually resembles the checkbox used in the [`SAP UI5`](https://ui5.sap.com/#/entity/sap.m.CheckBox/sample/sap.m.sample.CheckBox) design system.
242265

243266
<code-view style="height: 100px"
244267
no-theming
245268
data-demos-base-url="{environment:demosBaseUrl}"
246269
iframe-src="{environment:demosBaseUrl}/data-entries/checkbox-styling/" >
247270
</code-view>
248271

272+
> [!NOTE]
273+
> The sample uses the [Fluent Light](themes/sass/schemas.md#predefined-schemas) schema.
249274
250275
<div class="divider--half"></div>
251276

en/components/chip.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,23 @@ If everything's set up correctly, you should see this in your browser:
480480

481481
## Styling
482482

483-
To get started with styling the chip, we need to import the `index` file, where all the theme functions and component mixins live:
483+
Following the simplest approach, you can use CSS variables to customize the appearance of the chip:
484+
485+
```css
486+
igx-chip {
487+
--background: #cd201f;
488+
--hover-background: #cd201f;
489+
--focus-background: #9f1717;
490+
--text-color: #fff;
491+
}
492+
```
493+
By changing the values of these CSS variables, you can alter the entire look of the chip component.
494+
495+
<div class="divider--half"></div>
496+
497+
Another way to style the chip is by using **Sass**, along with our [`chip-theme`]({environment:sassApiUrl}/index.html#function-chip-theme) function.
498+
499+
To start styling the chip using **Sass**, first import the `index` file, which includes all theme functions and component mixins:
484500

485501
```scss
486502
@use "igniteui-angular/theming" as *;
@@ -492,21 +508,21 @@ To get started with styling the chip, we need to import the `index` file, where
492508
Following the simplest approach, we create a new theme that extends the [`chip-theme`]({environment:sassApiUrl}/themes#function-chip-theme) and accepts some parameters that style the chip's items. By specifying the `$background` or the `$selected-background`, the theme automatically calculates appropriate state colors and contrast foregrounds. You can still override any other parameter with custom values as needed.
493509

494510
```scss
495-
$custom-theme: chip-theme(
496-
$background: #57a5cd,
497-
$selected-background: #ecaa53,
498-
$remove-icon-color: #d81414,
499-
$border-radius: 5px,
511+
$custom-chip-theme: chip-theme(
512+
$background: #57a5cd,
513+
$selected-background: #ecaa53,
514+
$remove-icon-color: #d81414,
515+
$border-radius: 5px,
500516
);
501517
```
502518

503-
The last step is to **include** the component theme in our application.
519+
Finally, **include** the custom theme in your application:
504520

505521
```scss
506-
@include css-vars($custom-theme);
522+
@include css-vars($custom-chip-theme);
507523
```
508524

509-
### Demo
525+
In the sample below, you can see how using the chip component with customized CSS variables allows you to create a design that visually resembles the chip used in the [`Ant`](https://ant.design/components/tag?theme=light#tag-demo-icon) design system.
510526

511527
<code-view style="height:100px"
512528
no-theming

en/components/input-group.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ To customize the appearance of input groups, you can create a new theme by exten
452452
Even by specifying just a few core parameters—like colors for the border or background—you'll get a fully styled input group with consistent state-based styles (hover, focus, etc.) applied for you.
453453

454454
Here’s a simple example:
455-
455+
456456
```scss
457457
$custom-input-group: input-group-theme(
458458
$box-background: #57a5cd,
@@ -466,14 +466,17 @@ The last step is to include the newly created theme:
466466
@include css-vars($custom-input-group);
467467
```
468468

469-
### Demo
469+
In the sample below, you can see how using the input group with customized CSS variables allows you to create a design that visually resembles the one used in the [`Carbon`](https://carbondesignsystem.com/components/text-input/usage/#live-demo) design system.
470470

471471
<code-view style="height:230px"
472472
no-theming
473473
data-demos-base-url="{environment:demosBaseUrl}"
474474
iframe-src="{environment:demosBaseUrl}/data-entries/input-group-style/" >
475475
</code-view>
476476

477+
> [!NOTE]
478+
> The sample uses the [Indigo Light](themes/sass/schemas.md#predefined-schemas) schema.
479+
477480
>[!NOTE]
478481
>If your page includes multiple types of input groups — such as `box`, `border`, `line`, or `search` — it's best to scope your theme variables to the specific input group type.
479482
<br>For example:<br>

en/components/radio-button.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,30 @@ The final result would be something like that:
146146

147147
## Styling
148148

149-
To get started with styling the radio buttons, we need to import the `index` file, where all the theme functions and component mixins live:
149+
Following the simplest approach, you can use CSS variables to customize the appearance of the radio button:
150+
151+
```css
152+
igx-radio {
153+
--empty-color: #556b81;
154+
--label-color: #131e29;
155+
--fill-color: #0064d9;
156+
--focus-outline-color: #0032a5;
157+
}
158+
159+
igx-radio:hover {
160+
--empty-fill-color: #e3f0ff;
161+
--empty-color: #0064d9;
162+
--hover-color: transparent;
163+
}
164+
```
165+
166+
By changing the values of these CSS variables, you can alter the entire look of the component.
167+
168+
<div class="divider--half"></div>
169+
170+
Another way to style the radio button is by using **Sass**, along with our [`radio-theme`]({environment:sassApiUrl}/index.html#function-radio-theme) function.
171+
172+
To start styling the radio button using **Sass**, first import the `index` file, which includes all theme functions and component mixins:
150173

151174
```scss
152175
@use "igniteui-angular/theming" as *;
@@ -159,22 +182,27 @@ Following the simplest approach, we create a new theme that extends the [`radio-
159182

160183
```scss
161184
$custom-radio-theme: radio-theme(
162-
$empty-color: #345779,
163-
$fill-color: #2dabe8,
185+
$empty-color: #345779,
186+
$fill-color: #2dabe8,
164187
);
165188
```
166189

167-
The last step is to pass the custom radio theme in our application:
190+
Finally, **include** the custom theme in your application:
168191

169192
```scss
170193
@include css-vars($custom-radio-theme);
171194
```
172195

196+
In the sample below, you can see how using the radio button with customized CSS variables allows you to create a design that visually resembles the radio button used in the [`SAP UI5`](https://ui5.sap.com/#/entity/sap.m.RadioButton/sample/sap.m.sample.RadioButton) design system.
197+
173198
<code-view style="height: 300px"
174199
data-demos-base-url="{environment:demosBaseUrl}"
175200
iframe-src="{environment:demosBaseUrl}/data-entries/radio-styling-sample/" >
176201
</code-view>
177202

203+
> [!NOTE]
204+
> The sample uses the [Fluent Light](themes/sass/schemas.md#predefined-schemas) schema.
205+
178206
<div class="divider--half"></div>
179207

180208
## Radio Group

0 commit comments

Comments
 (0)