Skip to content

Commit 7d54ee6

Browse files
authored
Merge pull request #295 from IgniteUI/apetrov/add-recommended-slots
docs: add slot content recommendations
2 parents d2d1631 + 82bf12e commit 7d54ee6

24 files changed

Lines changed: 803 additions & 1358 deletions

docs/xplat/src/content/en/components/grids/list.mdx

Lines changed: 275 additions & 264 deletions
Large diffs are not rendered by default.

docs/xplat/src/content/en/components/inputs/button.mdx

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,14 @@ The {Platform} Button Component lets you enable clickable elements that trigger
2424

2525
</PlatformBlock>
2626

27-
2827
## {Platform} Button Example
2928

3029
<Sample src="/inputs/button/overview" height={100} alt="{Platform} Button Example" />
3130

32-
3331
## Usage
3432

35-
3633
<PlatformBlock for="WebComponents">
3734

38-
3935
First, you need to install the {ProductName} by running the following command:
4036

4137
```cmd
@@ -53,14 +49,10 @@ defineComponents(IgcButtonComponent);
5349

5450
For a complete introduction to the {ProductName}, read the [**Getting Started**](../general-getting-started.md) topic.
5551

56-
5752
</PlatformBlock>
5853

59-
60-
6154
<PlatformBlock for="React">
6255

63-
6456
First, you need to the install the corresponding {ProductName} npm package by running the following command:
6557

6658
```cmd
@@ -76,12 +68,8 @@ import 'igniteui-webcomponents/themes/light/bootstrap.css';
7668

7769
</PlatformBlock>
7870

79-
80-
8171
<PlatformBlock for="Blazor">
8272

83-
84-
8573
Before using the <ApiLink pkg="core" type="Button" />, you need to register it as follows:
8674

8775
```razor
@@ -96,10 +84,8 @@ You will also need to link an additional CSS file to apply the styling to the <A
9684
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />
9785
```
9886

99-
10087
</PlatformBlock>
10188

102-
10389
The simplest way to start using the <ApiLink pkg="core" type="Button" /> is as follows:
10490

10591
<PlatformBlock for="WebComponents">
@@ -130,11 +116,14 @@ The simplest way to start using the <ApiLink pkg="core" type="Button" /> is as f
130116

131117
With `prefix` and `suffix` slots of the <ApiLink pkg="core" type="Button" /> component, we can add different content before and after the main content of the button.
132118

119+
We recommend using a `<span>` element when adding simple text, symbols, or emojis, and an [`<igc-icon>`](../layouts/icon.md) component when adding icons to the `prefix` and `suffix` slots.
120+
133121
<PlatformBlock for="React">
134122

135123
```tsx
136124
<IgrButton type="button" variant="contained">
137-
<span slot="prefix">+</span>Click me<span slot="suffix">-</span>
125+
<span slot="prefix">Download</span>
126+
<IgrIcon slot="suffix" name="download"></IgrIcon>
138127
</IgrButton>
139128
```
140129

@@ -144,7 +133,8 @@ With `prefix` and `suffix` slots of the <ApiLink pkg="core" type="Button" /> com
144133

145134
```html
146135
<igc-button type="button" variant="contained">
147-
<span slot="prefix">+</span>Click me<span slot="suffix">-</span>
136+
<span slot="prefix">Download</span>
137+
<igc-icon slot="suffix" name="download"></igc-icon>
148138
</igc-button>
149139
```
150140

@@ -154,7 +144,8 @@ With `prefix` and `suffix` slots of the <ApiLink pkg="core" type="Button" /> com
154144

155145
```razor
156146
<IgbButton Variant="@ButtonVariant.Contained">
157-
<span slot="prefix">+</span>Click me<span slot="suffix">-</span>
147+
<span slot="prefix">Download</span>
148+
<IgbIcon slot="suffix" IconName="download"></IgbIcon>
158149
</IgbButton>
159150
```
160151

@@ -178,7 +169,7 @@ Use the <ApiLink pkg="core" type="Button" member="variant" label="Variant" /> at
178169
<PlatformBlock for="React">
179170

180171
```tsx
181-
<IgrButton variant="contained"><span>Contained</span></IgrButton>
172+
<IgrButton variant="contained">Contained</IgrButton>
182173
```
183174

184175
</PlatformBlock>
@@ -209,7 +200,7 @@ All you have to do to create an `outlined` button is to change the value of the
209200
<PlatformBlock for="React">
210201

211202
```tsx
212-
<IgrButton variant="outlined"><span>Outlined</span></IgrButton>
203+
<IgrButton variant="outlined">Outlined</IgrButton>
213204
```
214205

215206
</PlatformBlock>
@@ -240,7 +231,7 @@ Analogically, we can switch to `flat` variant.
240231
<PlatformBlock for="React">
241232

242233
```tsx
243-
<IgrButton variant="flat"><span>Flat</span></IgrButton>
234+
<IgrButton variant="flat">Flat</IgrButton>
244235
```
245236

246237
</PlatformBlock>
@@ -271,7 +262,7 @@ We can create a floating action button by setting the <ApiLink pkg="core" type="
271262
<PlatformBlock for="React">
272263

273264
```tsx
274-
<IgrButton variant="fab"><span>Fab</span></IgrButton>
265+
<IgrButton variant="fab">Fab</IgrButton>
275266
```
276267

277268
</PlatformBlock>
@@ -352,28 +343,28 @@ const onRadioChange = (e: IgrRadioChangeEventArgs) => {
352343

353344
<IgrRadioGroup alignment="horizontal" style={{ display: "flex", margin: "0 auto", width: "15%" }}>
354345
<IgrRadio name="size" value="small" labelPosition="after" checked={size === "small"} onChange={onRadioChange}>
355-
<span>Small</span>
346+
Small
356347
</IgrRadio>
357348
<IgrRadio name="size" value="medium" labelPosition="after" onChange={onRadioChange}>
358-
<span>Medium</span>
349+
Medium
359350
</IgrRadio>
360351
<IgrRadio name="size" value="large" labelPosition="after" onChange={onRadioChange}>
361-
<span>Large</span>
352+
Large
362353
</IgrRadio>
363354
</IgrRadioGroup>
364355

365356
<div className="button-container">
366357
<IgrButton className={"size-" + size} variant="flat">
367-
<span>Flat</span>
358+
Flat
368359
</IgrButton>
369360
<IgrButton className={"size-" + size} variant="contained">
370-
<span>Contained</span>
361+
Contained
371362
</IgrButton>
372363
<IgrButton className={"size-" + size} variant="outlined">
373-
<span>Outlined</span>
364+
Outlined
374365
</IgrButton>
375366
<IgrButton className={"size-" + size} variant="fab">
376-
<span>Like</span>
367+
Fab
377368
</IgrButton>
378369
</div>
379370
```
@@ -419,9 +410,6 @@ The result of implementing the above code should look like the following:
419410

420411
<Sample src="/inputs/button/size" height={200} alt="{Platform} Button Sizing Example" />
421412

422-
423-
424-
425413
### Download
426414

427415
Setting the <ApiLink pkg="core" type="Button" member="download" label="Download" /> property will prompt the user to save the linked URL instead of navigating to it.
@@ -434,7 +422,7 @@ Setting the <ApiLink pkg="core" type="Button" member="download" label="Download"
434422
variant="contained"
435423
download="url"
436424
target="_blank" >
437-
<span>Download</span>
425+
Download
438426
</IgrButton>
439427
```
440428

@@ -489,7 +477,6 @@ igc-button::part(base) {
489477

490478
<Sample src="/inputs/button/styling" height={100} alt="{Platform} Button Styling Example" />
491479

492-
493480
## API References
494481
<ApiLink pkg="core" type="Button" />
495482
<ApiLink pkg="core" type="RadioGroup" />

docs/xplat/src/content/en/components/inputs/chip.mdx

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,12 @@ import ApiLink from 'igniteui-astro-components/components/mdx/ApiLink.astro';
1818

1919
<Sample src="/inputs/chip/overview" height={80} alt="{Platform} Chip Example" />
2020

21-
2221
<igc-divider></igc-divider>
2322

2423
## Usage
2524

26-
2725
<PlatformBlock for="WebComponents">
2826

29-
3027
First, you need to install the {ProductName} by running the following command:
3128

3229
```cmd
@@ -44,14 +41,10 @@ defineComponents(IgcChipComponent);
4441

4542
For a complete introduction to the {ProductName}, read the [**Getting Started**](../general-getting-started.md) topic.
4643

47-
4844
</PlatformBlock>
4945

50-
51-
5246
<PlatformBlock for="React">
5347

54-
5548
First, you need to the install the corresponding {ProductName} npm package by running the following command:
5649

5750
```cmd
@@ -67,12 +60,8 @@ import 'igniteui-webcomponents/themes/light/bootstrap.css';
6760

6861
</PlatformBlock>
6962

70-
71-
7263
<PlatformBlock for="Blazor">
7364

74-
75-
7665
Before using the <ApiLink pkg="core" type="Chip" />, you need to register it as follows:
7766

7867
```razor
@@ -87,10 +76,8 @@ You will also need to link an additional CSS file to apply the styling to the <A
8776
<link href="_content/IgniteUI.Blazor/themes/light/bootstrap.css" rel="stylesheet" />
8877
```
8978

90-
9179
</PlatformBlock>
9280

93-
9481
The simplest way to start using the <ApiLink pkg="core" type="Chip" /> is as follows:
9582

9683
<PlatformBlock for="WebComponents">
@@ -212,9 +199,6 @@ The {ProductName} chip supports several pre-defined stylistic variants. You can
212199

213200
<Sample src="/inputs/chip/variants" height={80} alt="{Platform} Chip Variants Example" />
214201

215-
216-
217-
218202
### Disabled
219203

220204
The {ProductName} chip can be disabled by using the <ApiLink pkg="core" type="Chip" member="disabled" label="Disabled" /> property.
@@ -235,28 +219,55 @@ The {ProductName} chip can be disabled by using the <ApiLink pkg="core" type="Ch
235219

236220
</PlatformBlock>
237221

238-
### Prefix / Suffix
222+
### Slots
239223

240-
With the `Prefix` and `Suffix` parts of the <ApiLink pkg="core" type="Chip" /> component and their slots, we can add different content before and after the main content of the chip. We provide default select and remove icons but you can customize them using the <ApiLink pkg="core" type="Select" /> and `Remove` slots. You can add additional content before or after the main content, using the `Start` and `End` slots.
224+
With the exposed component slots, you can add custom content to different parts of the <ApiLink pkg="core" type="Chip" />. The component provides default select and remove icons, but you can customize them using the `select` and `remove` slots. You can also add additional content before or after the main content using the `start` and `end` slots.
225+
226+
We recommend using a `<span>` element when adding simple text, symbols, or emojis, and an [`<igc-icon>`](../layouts/icon.md) component when adding icons to the `remove`, `select`, `start`, and `end` slots.
241227

242228
<PlatformBlock for="WebComponents">
243229

244230
```html
245231
<igc-chip selectable removable>
246-
<span slot="select"><igc-icon name="verified-account"></igc-icon></span>
247-
<span slot="start"><igc-icon name="brush"></igc-icon></span>
232+
<igc-icon slot="select" name="verified-account"></igc-icon>
233+
<igc-icon slot="start" name="brush"></igc-icon>
248234
Chip
249-
<span slot="end"><igc-icon name="blood"></igc-icon></span>
250-
<span slot="remove"><igc-icon name="pacifier"></igc-icon></span>
235+
<igc-icon slot="end" name="blood"></igc-icon>
236+
<igc-icon slot="remove" name="pacifier"></igc-icon>
251237
</igc-chip>
252238
```
253239

254240
</PlatformBlock>
255241

256-
<Sample src="/inputs/chip/multiple" height={80} alt="{Platform} Chip Multiple Example" />
242+
<PlatformBlock for="Blazor">
243+
244+
```razor
245+
<IgbChip Selectable="true" Removable="true">
246+
<IgbIcon slot="select" IconName="verified-account" Collection="material"></IgbIcon>
247+
<IgbIcon slot="start" IconName="brush" Collection="material"></IgbIcon>
248+
Chip
249+
<IgbIcon slot="end" IconName="blood" Collection="material"></IgbIcon>
250+
<IgbIcon slot="remove" IconName="pacifier" Collection="material"></IgbIcon>
251+
</IgbChip>
252+
```
253+
254+
</PlatformBlock>
255+
256+
<PlatformBlock for="React">
257257

258+
```tsx
259+
<IgrChip selectable={true} removable={true}>
260+
<IgrIcon slot="select" name="verified-account"></IgrIcon>
261+
<IgrIcon slot="start" name="brush"></IgrIcon>
262+
<span>Chip</span>
263+
<IgrIcon slot="end" name="blood"></IgrIcon>
264+
<IgrIcon slot="remove" name="pacifier"></IgrIcon>
265+
</IgrChip>
266+
```
258267

268+
</PlatformBlock>
259269

270+
<Sample src="/inputs/chip/multiple" height={80} alt="{Platform} Chip Multiple Example" />
260271

261272
## Size
262273

@@ -294,8 +305,6 @@ We allow the user to choose the size of the <ApiLink pkg="core" type="Chip" /> b
294305

295306
<Sample src="/inputs/chip/size" height={80} alt="{Platform} Chip Size Example" />
296307

297-
298-
299308
## Styling
300309

301310
The <ApiLink pkg="core" type="Chip" /> component exposes a `base`, `prefix`, `suffix` CSS parts that can be used to change all of its style properties.
@@ -313,7 +322,6 @@ igc-chip::part(suffix) {
313322

314323
<Sample src="/inputs/chip/styling" height={80} alt="{Platform} Chip Styling Example" />
315324

316-
317325
## API References
318326
<ApiLink pkg="core" type="Chip" />
319327
## Additional Resources

0 commit comments

Comments
 (0)