@salesforce/design-system-react 11.0.0-rc.1 → 11.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/dist/cjs/components/accordion/index.cjs +1 -1
- package/dist/cjs/components/accordion/index.cjs.map +1 -1
- package/dist/cjs/components/accordion/panel.cjs.map +1 -1
- package/dist/cjs/components/builder-header/nav-dropdown.cjs.map +1 -1
- package/dist/cjs/components/builder-header/nav-link.cjs.map +1 -1
- package/dist/cjs/components/builder-header/toolbar.cjs.map +1 -1
- package/dist/cjs/components/button/index.cjs.map +1 -1
- package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
- package/dist/cjs/components/checkbox/index.cjs.map +1 -1
- package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/cjs/components/combobox/combobox.cjs +1 -1
- package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
- package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/cjs/components/date-picker/index.cjs.map +1 -1
- package/dist/cjs/components/files/file.cjs.map +1 -1
- package/dist/cjs/components/icon/index.cjs.map +1 -1
- package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
- package/dist/cjs/components/icon-settings/index.cjs.map +1 -1
- package/dist/cjs/components/input/index.cjs.map +1 -1
- package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
- package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
- package/dist/cjs/components/modal/index.cjs.map +1 -1
- package/dist/cjs/components/panel/filtering/group.cjs.map +1 -1
- package/dist/cjs/components/pill/index.cjs.map +1 -1
- package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
- package/dist/cjs/components/popover/popover.cjs.map +1 -1
- package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
- package/dist/cjs/components/progress-ring/index.cjs.map +1 -1
- package/dist/cjs/components/radio/index.cjs.map +1 -1
- package/dist/cjs/components/radio-group/check-props.cjs.map +1 -1
- package/dist/cjs/components/radio-group/index.cjs.map +1 -1
- package/dist/cjs/components/scoped-notification/index.cjs.map +1 -1
- package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
- package/dist/cjs/components/slider/index.cjs.map +1 -1
- package/dist/cjs/components/split-view/header.cjs.map +1 -1
- package/dist/cjs/components/tabs/index.cjs.map +1 -1
- package/dist/cjs/components/tabs/panel.cjs.map +1 -1
- package/dist/cjs/components/textarea/index.cjs +1 -1
- package/dist/cjs/components/textarea/index.cjs.map +1 -1
- package/dist/cjs/components/tooltip/index.cjs.map +1 -1
- package/dist/cjs/components/tree/tree.cjs.map +1 -1
- package/dist/cjs/components/trial-bar/button.cjs.map +1 -1
- package/dist/cjs/components/trial-bar/dropdown.cjs.map +1 -1
- package/dist/cjs/components/utilities/menu-list/item-label.cjs.map +1 -1
- package/dist/cjs/utilities/get-component-doc.cjs +1 -1
- package/dist/cjs/utilities/get-component-doc.cjs.map +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs +1 -1
- package/dist/cjs/utilities/warning/children-as-trigger.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property-value.cjs.map +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs +1 -1
- package/dist/cjs/utilities/warning/deprecated-property.cjs.map +1 -1
- package/dist/cjs/utilities/warning/removal-version.cjs +2 -0
- package/dist/cjs/utilities/warning/removal-version.cjs.map +1 -0
- package/dist/es/components/accordion/index.js +7 -3
- package/dist/es/components/accordion/index.js.map +1 -1
- package/dist/es/components/accordion/panel.js.map +1 -1
- package/dist/es/components/builder-header/nav-dropdown.js.map +1 -1
- package/dist/es/components/builder-header/nav-link.js.map +1 -1
- package/dist/es/components/builder-header/toolbar.js.map +1 -1
- package/dist/es/components/button/index.js.map +1 -1
- package/dist/es/components/button-stateful/index.js.map +1 -1
- package/dist/es/components/checkbox/index.js.map +1 -1
- package/dist/es/components/color-picker/color-picker.js.map +1 -1
- package/dist/es/components/combobox/combobox.js +4 -2
- package/dist/es/components/combobox/combobox.js.map +1 -1
- package/dist/es/components/date-picker/date-picker.js +1 -1
- package/dist/es/components/date-picker/date-picker.js.map +1 -1
- package/dist/es/components/date-picker/index.js.map +1 -1
- package/dist/es/components/files/file.js.map +1 -1
- package/dist/es/components/icon/index.js.map +1 -1
- package/dist/es/components/icon/input-icon/index.js.map +1 -1
- package/dist/es/components/icon-settings/index.js.map +1 -1
- package/dist/es/components/input/index.js.map +1 -1
- package/dist/es/components/input/private/inner-input.js.map +1 -1
- package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
- package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
- package/dist/es/components/modal/index.js.map +1 -1
- package/dist/es/components/panel/filtering/group.js.map +1 -1
- package/dist/es/components/pill/index.js.map +1 -1
- package/dist/es/components/popover/edit-dialog.js.map +1 -1
- package/dist/es/components/popover/popover.js.map +1 -1
- package/dist/es/components/progress-indicator/index.js.map +1 -1
- package/dist/es/components/progress-ring/index.js.map +1 -1
- package/dist/es/components/radio/index.js.map +1 -1
- package/dist/es/components/radio-group/check-props.js.map +1 -1
- package/dist/es/components/radio-group/index.js.map +1 -1
- package/dist/es/components/scoped-notification/index.js.map +1 -1
- package/dist/es/components/setup-assistant/step.js.map +1 -1
- package/dist/es/components/slider/index.js.map +1 -1
- package/dist/es/components/split-view/header.js.map +1 -1
- package/dist/es/components/tabs/index.js.map +1 -1
- package/dist/es/components/tabs/panel.js.map +1 -1
- package/dist/es/components/textarea/index.js +29 -44
- package/dist/es/components/textarea/index.js.map +1 -1
- package/dist/es/components/tooltip/index.js.map +1 -1
- package/dist/es/components/tree/tree.js.map +1 -1
- package/dist/es/components/trial-bar/button.js.map +1 -1
- package/dist/es/components/trial-bar/dropdown.js.map +1 -1
- package/dist/es/components/utilities/menu-list/item-label.js.map +1 -1
- package/dist/es/utilities/get-component-doc.js +6 -6
- package/dist/es/utilities/get-component-doc.js.map +1 -1
- package/dist/es/utilities/warning/children-as-trigger.js +9 -8
- package/dist/es/utilities/warning/children-as-trigger.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property-value.js +11 -10
- package/dist/es/utilities/warning/deprecated-property-value.js.map +1 -1
- package/dist/es/utilities/warning/deprecated-property.js +9 -8
- package/dist/es/utilities/warning/deprecated-property.js.map +1 -1
- package/dist/es/utilities/warning/removal-version.js +6 -0
- package/dist/es/utilities/warning/removal-version.js.map +1 -0
- package/dist/llms/components/accordion.md +267 -0
- package/dist/llms/components/alert.md +228 -0
- package/dist/llms/components/avatar.md +167 -0
- package/dist/llms/components/badge.md +153 -0
- package/dist/llms/components/breadcrumb.md +148 -0
- package/dist/llms/components/builder-header.examples.md +239 -0
- package/dist/llms/components/builder-header.md +736 -0
- package/dist/llms/components/button-group.md +167 -0
- package/dist/llms/components/button-stateful.md +246 -0
- package/dist/llms/components/button.md +661 -0
- package/dist/llms/components/card.md +368 -0
- package/dist/llms/components/carousel.md +365 -0
- package/dist/llms/components/checkbox.md +887 -0
- package/dist/llms/components/color-picker.md +591 -0
- package/dist/llms/components/combobox.examples.md +802 -0
- package/dist/llms/components/combobox.md +929 -0
- package/dist/llms/components/date-picker.md +546 -0
- package/dist/llms/components/docked-composer.md +173 -0
- package/dist/llms/components/dynamic-icon.md +226 -0
- package/dist/llms/components/expandable-section.md +198 -0
- package/dist/llms/components/files.md +337 -0
- package/dist/llms/components/filter.md +775 -0
- package/dist/llms/components/icon-settings.md +301 -0
- package/dist/llms/components/icon.md +1040 -0
- package/dist/llms/components/input.md +746 -0
- package/dist/llms/components/media-object.md +125 -0
- package/dist/llms/components/menu-dropdown.md +732 -0
- package/dist/llms/components/modal.md +504 -0
- package/dist/llms/components/page-header.md +282 -0
- package/dist/llms/components/panel.md +256 -0
- package/dist/llms/components/pill-container.md +218 -0
- package/dist/llms/components/pill.md +266 -0
- package/dist/llms/components/popover.md +600 -0
- package/dist/llms/components/portal-settings.md +371 -0
- package/dist/llms/components/progress-bar.md +175 -0
- package/dist/llms/components/progress-indicator.md +399 -0
- package/dist/llms/components/progress-ring.md +146 -0
- package/dist/llms/components/radio-button-group.md +285 -0
- package/dist/llms/components/radio-group.md +242 -0
- package/dist/llms/components/radio.md +269 -0
- package/dist/llms/components/scoped-notification.md +156 -0
- package/dist/llms/components/setup-assistant.md +398 -0
- package/dist/llms/components/simple-data-table.examples.md +2773 -0
- package/dist/llms/components/simple-data-table.md +919 -0
- package/dist/llms/components/slider.md +217 -0
- package/dist/llms/components/spinner.md +232 -0
- package/dist/llms/components/split-view.md +350 -0
- package/dist/llms/components/tabs.md +311 -0
- package/dist/llms/components/textarea.md +331 -0
- package/dist/llms/components/toast.md +267 -0
- package/dist/llms/components/tooltip.md +470 -0
- package/dist/llms/components/tree.md +1011 -0
- package/dist/llms/components/trial-bar.md +383 -0
- package/dist/llms/components/vertical-navigation.md +196 -0
- package/dist/llms/components/visual-picker.md +362 -0
- package/dist/llms/components/welcome-mat.md +885 -0
- package/dist/llms/docs/migration-v11.md +471 -0
- package/dist/llms/llms-full.txt +6874 -0
- package/dist/llms/llms.txt +133 -0
- package/dist/llms/rules.md +36 -0
- package/dist/types/components/accordion/index.d.ts.map +1 -1
- package/dist/types/components/accordion/panel.d.ts +7 -7
- package/dist/types/components/builder-header/nav-dropdown.d.ts +1 -0
- package/dist/types/components/builder-header/nav-dropdown.d.ts.map +1 -1
- package/dist/types/components/builder-header/nav-link.d.ts +0 -1
- package/dist/types/components/builder-header/nav-link.d.ts.map +1 -1
- package/dist/types/components/builder-header/toolbar.d.ts +0 -1
- package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
- package/dist/types/components/button/index.d.ts +6 -3
- package/dist/types/components/button/index.d.ts.map +1 -1
- package/dist/types/components/button-stateful/index.d.ts +4 -1
- package/dist/types/components/button-stateful/index.d.ts.map +1 -1
- package/dist/types/components/checkbox/index.d.ts +19 -5
- package/dist/types/components/checkbox/index.d.ts.map +1 -1
- package/dist/types/components/color-picker/color-picker.d.ts +6 -4
- package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
- package/dist/types/components/color-picker/types.d.ts +2 -2
- package/dist/types/components/combobox/combobox.d.ts +22 -0
- package/dist/types/components/combobox/combobox.d.ts.map +1 -1
- package/dist/types/components/date-picker/date-picker.d.ts +16 -4
- package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/components/date-picker/index.d.ts +2 -6
- package/dist/types/components/date-picker/index.d.ts.map +1 -1
- package/dist/types/components/files/file.d.ts +1 -1
- package/dist/types/components/icon/index.d.ts +1 -0
- package/dist/types/components/icon/index.d.ts.map +1 -1
- package/dist/types/components/icon/input-icon/index.d.ts +3 -0
- package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
- package/dist/types/components/icon-settings/index.d.ts.map +1 -1
- package/dist/types/components/input/index.d.ts +2 -1
- package/dist/types/components/input/index.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/button-trigger.d.ts +5 -0
- package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +4 -0
- package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
- package/dist/types/components/modal/index.d.ts +5 -5
- package/dist/types/components/page-header/types.d.ts +3 -0
- package/dist/types/components/page-header/types.d.ts.map +1 -1
- package/dist/types/components/panel/filtering/group.d.ts +2 -0
- package/dist/types/components/panel/filtering/group.d.ts.map +1 -1
- package/dist/types/components/pill/index.d.ts +1 -0
- package/dist/types/components/pill/index.d.ts.map +1 -1
- package/dist/types/components/popover/edit-dialog.d.ts +1 -3
- package/dist/types/components/popover/edit-dialog.d.ts.map +1 -1
- package/dist/types/components/popover/popover.d.ts +1 -0
- package/dist/types/components/popover/popover.d.ts.map +1 -1
- package/dist/types/components/progress-indicator/index.d.ts +1 -0
- package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
- package/dist/types/components/progress-ring/index.d.ts +1 -0
- package/dist/types/components/progress-ring/index.d.ts.map +1 -1
- package/dist/types/components/radio/index.d.ts +2 -2
- package/dist/types/components/radio/index.d.ts.map +1 -1
- package/dist/types/components/radio-group/index.d.ts +2 -0
- package/dist/types/components/radio-group/index.d.ts.map +1 -1
- package/dist/types/components/scoped-notification/index.d.ts +1 -0
- package/dist/types/components/scoped-notification/index.d.ts.map +1 -1
- package/dist/types/components/setup-assistant/step.d.ts +0 -1
- package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
- package/dist/types/components/simple-data-table/types.d.ts +1 -0
- package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
- package/dist/types/components/slider/index.d.ts +4 -2
- package/dist/types/components/slider/index.d.ts.map +1 -1
- package/dist/types/components/tabs/index.d.ts +1 -0
- package/dist/types/components/tabs/index.d.ts.map +1 -1
- package/dist/types/components/tabs/panel.d.ts +2 -1
- package/dist/types/components/tabs/panel.d.ts.map +1 -1
- package/dist/types/components/textarea/index.d.ts +9 -40
- package/dist/types/components/textarea/index.d.ts.map +1 -1
- package/dist/types/components/tooltip/index.d.ts +5 -0
- package/dist/types/components/tooltip/index.d.ts.map +1 -1
- package/dist/types/components/tree/tree.d.ts +5 -0
- package/dist/types/components/tree/tree.d.ts.map +1 -1
- package/dist/types/components/utilities/menu-list/item-label.d.ts +12 -0
- package/dist/types/components/utilities/menu-list/item-label.d.ts.map +1 -1
- package/package.json +8 -5
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
# Icon
|
|
2
|
+
|
|
3
|
+
The Icon component is the Lightning Design System Icon component and should be used for naked icons.
|
|
4
|
+
For icons that are buttons, use the Button component with `variant='icon'`.
|
|
5
|
+
|
|
6
|
+
## Import
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { Icon, ButtonIcon, InputIcon } from '@salesforce/design-system-react';
|
|
10
|
+
// or, one entry point per module:
|
|
11
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
12
|
+
import ButtonIcon from '@salesforce/design-system-react/components/icon/button-icon';
|
|
13
|
+
import InputIcon from '@salesforce/design-system-react/components/icon/input-icon';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Icon props
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import type { IconProps } from '@salesforce/design-system-react/components/icon';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Required | Description |
|
|
23
|
+
| --- | --- | --- | --- |
|
|
24
|
+
| `assistiveText` | `{ /** Visually hidden label read in place of the icon. Leave unset for a decorative icon. */ label?: string; }` | | Assistive text for accessibility |
|
|
25
|
+
| `category` | `IconCategory` (`'action' \| 'custom' \| 'doctype' \| 'standard' \| 'utility'`) | | Icon category from SLDS |
|
|
26
|
+
| `className` | `string \| string[] \| Record<string, boolean>` | | CSS classes for the SVG element |
|
|
27
|
+
| `colorVariant` | `IconColorVariant` (`'error' \| 'warning' \| 'default' \| 'light' \| 'success' \| 'base'`) | | Icon color variant |
|
|
28
|
+
| `containerClassName` | `string \| string[] \| Record<string, boolean>` | | CSS classes for the container span |
|
|
29
|
+
| `containerStyle` | `CSSProperties` | | Styles for the container span |
|
|
30
|
+
| `icon` | `InlineIconData` | | Custom SVG icon data |
|
|
31
|
+
| `inverse` | `boolean` | | Invert colors for dark backgrounds |
|
|
32
|
+
| `name` | `string` | | Name of the icon |
|
|
33
|
+
| `path` | `string` | | Direct path to the icon sprite |
|
|
34
|
+
| `productTheme` | `ProductTheme` (`'global-setup' \| 'service-cloud' \| 'industry-cloud' \| 'sales-cloud' \| 'commerce-cloud' \| 'community-cloud' \| 'marketing-cloud' \| 'quip'`) | | **Deprecated.** Removed before 11.0.0. These legacy product brand colors aren't SLDS 2 theme values; set the background color yourself with `style` or `className`, for example `style={{ backgroundColor: '#00857d' }}`.<br><br>Background theme color (only for standard category) |
|
|
35
|
+
| `size` | `IconSize` (`'x-small' \| 'small' \| 'medium' \| 'large' \| 'xx-small'`) | | Size of the icon |
|
|
36
|
+
| `style` | `CSSProperties` | | Custom styles for the SVG |
|
|
37
|
+
| `title` | `string` | | HTML title attribute for the container |
|
|
38
|
+
|
|
39
|
+
## ButtonIcon props
|
|
40
|
+
|
|
41
|
+
This is a non-interactive wrapper component for `UtilityIcon` that specifies button icon classes for an icon inside a `button` tag. Use of this component by itself is not recommended, but should be used as part of other components to obtain the correct styling for icons within buttons. This component only partially implements [Button Icons](http://www.lightningdesignsystem.com/components/button-icons). It does not return a `button` HTML tag. It only returns an icon for use within a button. Assistive text must also be rendered by the parent.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import type { ButtonIconProps } from '@salesforce/design-system-react/components/icon/button-icon';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Required | Description |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `category` | `'action' \| 'custom' \| 'doctype' \| 'standard' \| 'utility'` | | Icon category from [lightningdesignsystem.com/icons/](https://www.lightningdesignsystem.com/icons/) |
|
|
50
|
+
| `className` | `unknown[] \| Record<string, unknown> \| string` | | Class names to be added to the SVG. |
|
|
51
|
+
| `hint` | `boolean` | | Associates an icon button with another element on the page by changes the color of the SVG. Please reference <a href="http://www.lightningdesignsystem.com/components/buttons/#hint">Lightning Design System Buttons > Hint</a>. |
|
|
52
|
+
| `icon` | `InlineIconData` | | An SVG object to use instead of name / category, look in `design-system-react/icons` for examples |
|
|
53
|
+
| `inverse` | `boolean` | | Setting `inverse` to true will switch the color of the icon: light to dark, dark to light. |
|
|
54
|
+
| `name` | `string` | | Name of the icon. Visit <a href='http://www.lightningdesignsystem.com/resources/icons'>Lightning Design System Icons</a> to reference icon names. |
|
|
55
|
+
| `path` | `string` | | Path to the icon. This will override any global icon settings. |
|
|
56
|
+
| `position` | `'left' \| 'right'` | | Adds additional spacing on the opposite side specified between button icon and the button label |
|
|
57
|
+
| `size` | `'xx-small' \| 'x-small' \| 'small' \| 'medium' \| 'large'` (`'x-small' \| 'small' \| 'medium' \| 'large' \| 'xx-small'`) | | Size of the icon. Visit [lightningdesignsystem.com/components/icons/#flavor-sizes](https://www.lightningdesignsystem.com/components/icons/#flavor-sizes) |
|
|
58
|
+
|
|
59
|
+
## InputIcon props
|
|
60
|
+
|
|
61
|
+
A wrapper for icons that will be rendered inside of an Input
|
|
62
|
+
|
|
63
|
+
If the `onClick` function prop is provided, the `design-system-react/components/button` component is used.
|
|
64
|
+
If not, the icon will be an instance of `design-system-react/components/utilities/utility-icon`.
|
|
65
|
+
Checkout out the appropriate component to see what props can be passed along via the `{...props}` rest operator
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import type { InputIconProps } from '@salesforce/design-system-react/components/icon/input-icon';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The props type is a union: some props only apply to some variants (see the Types block). A prop is marked required only when every variant requires it.
|
|
72
|
+
|
|
73
|
+
| Prop | Type | Required | Description |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| `assistiveText` | `{ /** Label of the icon button. */ icon: string; } \| Record<string, string>` | | Assistive text for the icon button |
|
|
76
|
+
| `buttonRef` | `(node: HTMLButtonElement \| null) => void` | | Receives the button node |
|
|
77
|
+
| `category` | `IconCategory` (`'action' \| 'custom' \| 'doctype' \| 'standard' \| 'utility'`) | | Icon category from [lightningdesignsystem.com/icons/](https://www.lightningdesignsystem.com/icons/) |
|
|
78
|
+
| `className` | `string` | | CSS class name |
|
|
79
|
+
| `direction` | `string` | | Text direction for RTL support |
|
|
80
|
+
| `icon` | `InlineIconData` | | Custom SVG icon data |
|
|
81
|
+
| `iconPosition` | `'left' \| 'right'` | | This is only needed if an input contains two icons, the Input component handles this prop for you. |
|
|
82
|
+
| `name` | `string` | | Name of the icon. Visit <a href='http://www.lightningdesignsystem.com/resources/icons'>Lightning Design System Icons</a> to reference icon names. |
|
|
83
|
+
| `onClick` | `(event: MouseEvent<HTMLButtonElement>) => void` | | This event fires when the icon is clicked. |
|
|
84
|
+
| `path` | `string` | | Path to the icon. This will override any global icon settings. |
|
|
85
|
+
| `style` | `CSSProperties` | | Inline styles |
|
|
86
|
+
| `title` | `string` | | Tooltip text |
|
|
87
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | | The button's `type`. |
|
|
88
|
+
| `variant` | `'base' \| 'combobox'` | | Changes styles of the InputIcon. |
|
|
89
|
+
|
|
90
|
+
Accepts a `ref`: `Ref<SVGSVGElement>`.
|
|
91
|
+
|
|
92
|
+
Other props from `AriaAttributes`, `ButtonHTMLAttributes`, `DOMAttributes`, `HTMLAttributes`, `SVGAttributes` (`@types/react`) pass through to the element.
|
|
93
|
+
|
|
94
|
+
## Types
|
|
95
|
+
|
|
96
|
+
Declarations the props above refer to, from the package `.d.ts`:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
/**
|
|
100
|
+
* Icon category types matching SLDS icon categories
|
|
101
|
+
*/
|
|
102
|
+
export type IconCategory = 'action' | 'custom' | 'doctype' | 'standard' | 'utility';
|
|
103
|
+
|
|
104
|
+
export type IconColorVariant = 'base' | 'default' | 'error' | 'light' | 'warning' | 'success';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Shape of inline SVG icon data passed to the `icon` prop
|
|
108
|
+
*/
|
|
109
|
+
export interface InlineIconData {
|
|
110
|
+
viewBox?: string;
|
|
111
|
+
path?: Record<string, string> | Array<Record<string, string>>;
|
|
112
|
+
g?: Record<string, unknown> | Array<Record<string, unknown>>;
|
|
113
|
+
circle?: Record<string, string> | Array<Record<string, string>>;
|
|
114
|
+
ellipse?: Record<string, string> | Array<Record<string, string>>;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Product theme types for icon backgrounds
|
|
120
|
+
* @deprecated Removed before 11.0.0. Set the background color with `style` or `className`.
|
|
121
|
+
*/
|
|
122
|
+
export type ProductTheme = 'global-setup' | 'service-cloud' | 'industry-cloud' | 'sales-cloud' | 'commerce-cloud' | 'community-cloud' | 'marketing-cloud' | 'quip';
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Icon size types
|
|
126
|
+
*/
|
|
127
|
+
export type IconSize = 'xx-small' | 'x-small' | 'small' | 'medium' | 'large';
|
|
128
|
+
|
|
129
|
+
/** Props for InputIcon: `onClick` selects between a button and a decorative icon. */
|
|
130
|
+
export type InputIconProps = InputIconClickableProps | InputIconDecorativeProps;
|
|
131
|
+
|
|
132
|
+
/** A clickable icon, rendered as an icon `Button`. */
|
|
133
|
+
export interface InputIconClickableProps extends InputIconBaseProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'className' | 'onClick' | 'style' | 'title' | 'type'> {
|
|
134
|
+
/** Assistive text for the icon button */
|
|
135
|
+
assistiveText: {
|
|
136
|
+
/** Label of the icon button. */
|
|
137
|
+
icon: string;
|
|
138
|
+
};
|
|
139
|
+
/** This event fires when the icon is clicked. */
|
|
140
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
141
|
+
/** Receives the button node */
|
|
142
|
+
buttonRef?: (node: HTMLButtonElement | null) => void;
|
|
143
|
+
/** The button's `type`. */
|
|
144
|
+
type?: 'button' | 'submit' | 'reset';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** A decorative icon, rendered as a `UtilityIcon`. */
|
|
148
|
+
export interface InputIconDecorativeProps extends InputIconBaseProps, Omit<UtilityIconProps, 'category' | 'name' | 'path' | 'onClick'> {
|
|
149
|
+
/** Unset for a decorative icon; pass `onClick` for a button. */
|
|
150
|
+
onClick?: undefined;
|
|
151
|
+
/** Tooltip text */
|
|
152
|
+
title?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Props for UtilityIcon component
|
|
157
|
+
*/
|
|
158
|
+
export interface UtilityIconProps extends Omit<SVGProps<SVGSVGElement>, 'name'> {
|
|
159
|
+
/** Assistive text for accessibility (not used directly, passed through) */
|
|
160
|
+
assistiveText?: Record<string, string>;
|
|
161
|
+
/** Icon category */
|
|
162
|
+
category?: IconCategory;
|
|
163
|
+
/** Custom SVG icon data */
|
|
164
|
+
icon?: InlineIconData;
|
|
165
|
+
/** Name of the icon */
|
|
166
|
+
name?: string;
|
|
167
|
+
/** Direct path to the icon sprite */
|
|
168
|
+
path?: string;
|
|
169
|
+
/** Text direction for RTL support */
|
|
170
|
+
direction?: string;
|
|
171
|
+
/** CSS class name */
|
|
172
|
+
className?: string;
|
|
173
|
+
/** Inline styles */
|
|
174
|
+
style?: CSSProperties;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Examples
|
|
179
|
+
|
|
180
|
+
Every story in Storybook for this component, in sidebar order, as code for an app: imports use the package paths, and Storybook's own code (`meta`, decorators, `parameters`) is left out. A story that renders an `__examples__` file shows that file the first time. Icons are served from `/assets/icons` (see `IconSettings`). Storybook: <https://opensource.salesforce.com/design-system-react/?path=/docs/components-icon--docs>.
|
|
181
|
+
|
|
182
|
+
### Shared code: `components/icon/__docs__/Icon.stories.jsx`
|
|
183
|
+
|
|
184
|
+
The stories from Components/Icon below use these imports and helpers.
|
|
185
|
+
|
|
186
|
+
```jsx
|
|
187
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
188
|
+
import Standard from './standard';
|
|
189
|
+
import ColorBase from './color-base';
|
|
190
|
+
import UNSAFE_DirectionSettings from '@salesforce/design-system-react/components/utilities/UNSAFE_direction';
|
|
191
|
+
|
|
192
|
+
const makeRtl = (component) => (
|
|
193
|
+
// eslint-disable-next-line
|
|
194
|
+
<UNSAFE_DirectionSettings.Provider value="rtl">
|
|
195
|
+
<div dir="rtl">{component}</div>
|
|
196
|
+
</UNSAFE_DirectionSettings.Provider>
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
// Inline SVG data for the utility `download` icon, passed to the `icon` prop.
|
|
200
|
+
const download = {
|
|
201
|
+
viewBox: '0 0 52 52',
|
|
202
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
|
203
|
+
g: {
|
|
204
|
+
path: [
|
|
205
|
+
{
|
|
206
|
+
d: 'M48.5 31h-3c-.8 0-1.5.7-1.5 1.5v10c0 .8-.7 1.5-1.5 1.5h-33c-.8 0-1.5-.7-1.5-1.5v-10c0-.8-.7-1.5-1.5-1.5h-3c-.8 0-1.5.7-1.5 1.5V46c0 2.2 1.8 4 4 4h40c2.2 0 4-1.8 4-4V32.5c0-.8-.7-1.5-1.5-1.5z',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
d: 'M25 37.6c.6.6 1.5.6 2.1 0l13.5-13.5c.6-.6.6-1.5 0-2.1l-2.1-2.1c-.6-.6-1.5-.6-2.1 0l-5.6 5.6c-.6.6-1.7.2-1.7-.7V3.5C29 2.7 28.2 2 27.5 2h-3c-.8 0-1.5.7-1.5 1.5v21.2c0 .9-1.1 1.3-1.7.7l-5.6-5.6c-.6-.6-1.5-.6-2.1 0L11.5 22c-.6.6-.6 1.5 0 2.1L25 37.6z',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Category: Standard
|
|
217
|
+
|
|
218
|
+
`standard.jsx` (from `components/icon/__examples__/standard.jsx`):
|
|
219
|
+
|
|
220
|
+
```jsx
|
|
221
|
+
import React from 'react';
|
|
222
|
+
|
|
223
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
224
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
225
|
+
|
|
226
|
+
class Example extends React.Component {
|
|
227
|
+
static displayName = 'IconExample';
|
|
228
|
+
|
|
229
|
+
render() {
|
|
230
|
+
return (
|
|
231
|
+
<IconSettings iconPath="/assets/icons">
|
|
232
|
+
<Icon
|
|
233
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
234
|
+
category="standard"
|
|
235
|
+
name="branch_merge"
|
|
236
|
+
title="description of icon"
|
|
237
|
+
/>
|
|
238
|
+
</IconSettings>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export default Example;
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Category: Standard - Right to Left (RTL)
|
|
247
|
+
|
|
248
|
+
```jsx
|
|
249
|
+
const CategoryStandardRightToLeftRTL = () => makeRtl(<Standard />);
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Category: Utility
|
|
253
|
+
|
|
254
|
+
`utility.jsx` (from `components/icon/__examples__/utility.jsx`):
|
|
255
|
+
|
|
256
|
+
```jsx
|
|
257
|
+
import React from 'react';
|
|
258
|
+
|
|
259
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
260
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
261
|
+
|
|
262
|
+
class Example extends React.Component {
|
|
263
|
+
static displayName = 'IconExample';
|
|
264
|
+
|
|
265
|
+
render() {
|
|
266
|
+
return (
|
|
267
|
+
<IconSettings iconPath="/assets/icons">
|
|
268
|
+
<Icon
|
|
269
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
270
|
+
category="utility"
|
|
271
|
+
colorVariant="default"
|
|
272
|
+
name="announcement"
|
|
273
|
+
size="small"
|
|
274
|
+
title="description of icon when needed"
|
|
275
|
+
/>
|
|
276
|
+
</IconSettings>
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export default Example;
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Category: Action
|
|
285
|
+
|
|
286
|
+
`action.jsx` (from `components/icon/__examples__/action.jsx`):
|
|
287
|
+
|
|
288
|
+
```jsx
|
|
289
|
+
import React from 'react';
|
|
290
|
+
|
|
291
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
292
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
293
|
+
|
|
294
|
+
class Example extends React.Component {
|
|
295
|
+
static displayName = 'IconExample';
|
|
296
|
+
|
|
297
|
+
render() {
|
|
298
|
+
return (
|
|
299
|
+
<IconSettings iconPath="/assets/icons">
|
|
300
|
+
<Icon
|
|
301
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
302
|
+
category="action"
|
|
303
|
+
name="description"
|
|
304
|
+
size="small"
|
|
305
|
+
/>
|
|
306
|
+
</IconSettings>
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export default Example;
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Category: Doctype
|
|
315
|
+
|
|
316
|
+
`doctype.jsx` (from `components/icon/__examples__/doctype.jsx`):
|
|
317
|
+
|
|
318
|
+
```jsx
|
|
319
|
+
import React from 'react';
|
|
320
|
+
|
|
321
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
322
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
323
|
+
|
|
324
|
+
class Example extends React.Component {
|
|
325
|
+
static displayName = 'IconExample';
|
|
326
|
+
|
|
327
|
+
render() {
|
|
328
|
+
return (
|
|
329
|
+
<IconSettings iconPath="/assets/icons">
|
|
330
|
+
<Icon
|
|
331
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
332
|
+
category="doctype"
|
|
333
|
+
name="xml"
|
|
334
|
+
/>
|
|
335
|
+
</IconSettings>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export default Example;
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Category: Custom
|
|
344
|
+
|
|
345
|
+
`custom.jsx` (from `components/icon/__examples__/custom.jsx`):
|
|
346
|
+
|
|
347
|
+
```jsx
|
|
348
|
+
import React from 'react';
|
|
349
|
+
|
|
350
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
351
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
352
|
+
|
|
353
|
+
class Example extends React.Component {
|
|
354
|
+
static displayName = 'IconExample';
|
|
355
|
+
|
|
356
|
+
render() {
|
|
357
|
+
return (
|
|
358
|
+
<IconSettings iconPath="/assets/icons">
|
|
359
|
+
<Icon
|
|
360
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
361
|
+
category="custom"
|
|
362
|
+
name="custom5"
|
|
363
|
+
title="description of icon when needed"
|
|
364
|
+
/>
|
|
365
|
+
</IconSettings>
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export default Example;
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Category: External Path
|
|
374
|
+
|
|
375
|
+
`external-path.jsx` (from `components/icon/__examples__/external-path.jsx`):
|
|
376
|
+
|
|
377
|
+
```jsx
|
|
378
|
+
import React from 'react';
|
|
379
|
+
|
|
380
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
381
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
382
|
+
|
|
383
|
+
class Example extends React.Component {
|
|
384
|
+
static displayName = 'IconExample';
|
|
385
|
+
|
|
386
|
+
render() {
|
|
387
|
+
return (
|
|
388
|
+
<IconSettings iconPath="/assets/icons">
|
|
389
|
+
<Icon
|
|
390
|
+
assistiveText={{ label: 'We got news!' }}
|
|
391
|
+
inverse
|
|
392
|
+
path="/assets/icons/utility-sprite/svg/symbols.svg#announcement"
|
|
393
|
+
size="medium"
|
|
394
|
+
/>
|
|
395
|
+
</IconSettings>
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export default Example;
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Size: X-Small
|
|
404
|
+
|
|
405
|
+
`sizes-extra-small.jsx` (from `components/icon/__examples__/sizes-extra-small.jsx`):
|
|
406
|
+
|
|
407
|
+
```jsx
|
|
408
|
+
import React from 'react';
|
|
409
|
+
|
|
410
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
411
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
412
|
+
|
|
413
|
+
class Example extends React.Component {
|
|
414
|
+
static displayName = 'IconExample';
|
|
415
|
+
|
|
416
|
+
render() {
|
|
417
|
+
return (
|
|
418
|
+
<IconSettings iconPath="/assets/icons">
|
|
419
|
+
<Icon
|
|
420
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
421
|
+
category="utility"
|
|
422
|
+
name="warning"
|
|
423
|
+
size="x-small"
|
|
424
|
+
/>
|
|
425
|
+
</IconSettings>
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export default Example;
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Size: Small
|
|
434
|
+
|
|
435
|
+
`sizes-small.jsx` (from `components/icon/__examples__/sizes-small.jsx`):
|
|
436
|
+
|
|
437
|
+
```jsx
|
|
438
|
+
import React from 'react';
|
|
439
|
+
|
|
440
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
441
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
442
|
+
|
|
443
|
+
class Example extends React.Component {
|
|
444
|
+
static displayName = 'IconExample';
|
|
445
|
+
|
|
446
|
+
render() {
|
|
447
|
+
return (
|
|
448
|
+
<IconSettings iconPath="/assets/icons">
|
|
449
|
+
<Icon
|
|
450
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
451
|
+
category="standard"
|
|
452
|
+
name="case"
|
|
453
|
+
size="small"
|
|
454
|
+
/>
|
|
455
|
+
</IconSettings>
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export default Example;
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### Size: Medium (default)
|
|
464
|
+
|
|
465
|
+
`sizes-medium.jsx` (from `components/icon/__examples__/sizes-medium.jsx`):
|
|
466
|
+
|
|
467
|
+
```jsx
|
|
468
|
+
import React from 'react';
|
|
469
|
+
|
|
470
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
471
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
472
|
+
|
|
473
|
+
class Example extends React.Component {
|
|
474
|
+
static displayName = 'IconExample';
|
|
475
|
+
|
|
476
|
+
render() {
|
|
477
|
+
return (
|
|
478
|
+
<IconSettings iconPath="/assets/icons">
|
|
479
|
+
<Icon
|
|
480
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
481
|
+
category="standard"
|
|
482
|
+
name="case"
|
|
483
|
+
/>
|
|
484
|
+
</IconSettings>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export default Example;
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Size: Large
|
|
493
|
+
|
|
494
|
+
`sizes-large.jsx` (from `components/icon/__examples__/sizes-large.jsx`):
|
|
495
|
+
|
|
496
|
+
```jsx
|
|
497
|
+
import React from 'react';
|
|
498
|
+
|
|
499
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
500
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
501
|
+
|
|
502
|
+
class Example extends React.Component {
|
|
503
|
+
static displayName = 'IconExample';
|
|
504
|
+
|
|
505
|
+
render() {
|
|
506
|
+
return (
|
|
507
|
+
<IconSettings iconPath="/assets/icons">
|
|
508
|
+
<Icon
|
|
509
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
510
|
+
category="standard"
|
|
511
|
+
name="case"
|
|
512
|
+
size="large"
|
|
513
|
+
/>
|
|
514
|
+
</IconSettings>
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export default Example;
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Color: Base
|
|
523
|
+
|
|
524
|
+
```jsx
|
|
525
|
+
const ColorBase1 = () => (
|
|
526
|
+
<div
|
|
527
|
+
style={{
|
|
528
|
+
backgroundColor: 'goldenrod',
|
|
529
|
+
padding: '10px',
|
|
530
|
+
}}
|
|
531
|
+
>
|
|
532
|
+
<ColorBase />
|
|
533
|
+
</div>
|
|
534
|
+
);
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
`color-base.jsx` (from `components/icon/__examples__/color-base.jsx`):
|
|
538
|
+
|
|
539
|
+
```jsx
|
|
540
|
+
import React from 'react';
|
|
541
|
+
|
|
542
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
543
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
544
|
+
|
|
545
|
+
class Example extends React.Component {
|
|
546
|
+
static displayName = 'IconExample';
|
|
547
|
+
|
|
548
|
+
render() {
|
|
549
|
+
return (
|
|
550
|
+
<IconSettings iconPath="/assets/icons">
|
|
551
|
+
<Icon
|
|
552
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
553
|
+
category="utility"
|
|
554
|
+
name="announcement"
|
|
555
|
+
title="description of icon when needed"
|
|
556
|
+
inverse
|
|
557
|
+
/>
|
|
558
|
+
</IconSettings>
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export default Example;
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Color: Default
|
|
567
|
+
|
|
568
|
+
`color-default.jsx` (from `components/icon/__examples__/color-default.jsx`):
|
|
569
|
+
|
|
570
|
+
```jsx
|
|
571
|
+
import React from 'react';
|
|
572
|
+
|
|
573
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
574
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
575
|
+
|
|
576
|
+
class Example extends React.Component {
|
|
577
|
+
static displayName = 'IconExample';
|
|
578
|
+
|
|
579
|
+
render() {
|
|
580
|
+
return (
|
|
581
|
+
<IconSettings iconPath="/assets/icons">
|
|
582
|
+
<Icon
|
|
583
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
584
|
+
category="utility"
|
|
585
|
+
name="announcement"
|
|
586
|
+
title="This is a title"
|
|
587
|
+
/>
|
|
588
|
+
</IconSettings>
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export default Example;
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Color: Success
|
|
597
|
+
|
|
598
|
+
`color-success.jsx` (from `components/icon/__examples__/color-success.jsx`):
|
|
599
|
+
|
|
600
|
+
```jsx
|
|
601
|
+
import React from 'react';
|
|
602
|
+
|
|
603
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
604
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
605
|
+
|
|
606
|
+
class Example extends React.Component {
|
|
607
|
+
static displayName = 'IconExample';
|
|
608
|
+
|
|
609
|
+
render() {
|
|
610
|
+
return (
|
|
611
|
+
<IconSettings iconPath="/assets/icons">
|
|
612
|
+
<Icon
|
|
613
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
614
|
+
category="utility"
|
|
615
|
+
colorVariant="success"
|
|
616
|
+
name="announcement"
|
|
617
|
+
title="description of icon"
|
|
618
|
+
/>
|
|
619
|
+
</IconSettings>
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export default Example;
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
### Color: Error
|
|
628
|
+
|
|
629
|
+
`color-error.jsx` (from `components/icon/__examples__/color-error.jsx`):
|
|
630
|
+
|
|
631
|
+
```jsx
|
|
632
|
+
import React from 'react';
|
|
633
|
+
|
|
634
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
635
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
636
|
+
|
|
637
|
+
class Example extends React.Component {
|
|
638
|
+
static displayName = 'IconExample';
|
|
639
|
+
|
|
640
|
+
render() {
|
|
641
|
+
return (
|
|
642
|
+
<IconSettings iconPath="/assets/icons">
|
|
643
|
+
<Icon
|
|
644
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
645
|
+
category="utility"
|
|
646
|
+
colorVariant="error"
|
|
647
|
+
name="announcement"
|
|
648
|
+
title="description of icon"
|
|
649
|
+
/>
|
|
650
|
+
</IconSettings>
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export default Example;
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
### Color: Warning
|
|
659
|
+
|
|
660
|
+
`color-warning.jsx` (from `components/icon/__examples__/color-warning.jsx`):
|
|
661
|
+
|
|
662
|
+
```jsx
|
|
663
|
+
import React from 'react';
|
|
664
|
+
|
|
665
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
666
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
667
|
+
|
|
668
|
+
class Example extends React.Component {
|
|
669
|
+
static displayName = 'IconExample';
|
|
670
|
+
|
|
671
|
+
render() {
|
|
672
|
+
return (
|
|
673
|
+
<IconSettings iconPath="/assets/icons">
|
|
674
|
+
<Icon
|
|
675
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
676
|
+
category="utility"
|
|
677
|
+
colorVariant="warning"
|
|
678
|
+
name="announcement"
|
|
679
|
+
title="description of icon"
|
|
680
|
+
/>
|
|
681
|
+
</IconSettings>
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
export default Example;
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
### Color: Light
|
|
690
|
+
|
|
691
|
+
`color-light.jsx` (from `components/icon/__examples__/color-light.jsx`):
|
|
692
|
+
|
|
693
|
+
```jsx
|
|
694
|
+
import React from 'react';
|
|
695
|
+
|
|
696
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
697
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
698
|
+
|
|
699
|
+
class Example extends React.Component {
|
|
700
|
+
static displayName = 'IconExample';
|
|
701
|
+
|
|
702
|
+
render() {
|
|
703
|
+
return (
|
|
704
|
+
<IconSettings iconPath="/assets/icons">
|
|
705
|
+
<Icon
|
|
706
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
707
|
+
category="utility"
|
|
708
|
+
colorVariant="light"
|
|
709
|
+
name="announcement"
|
|
710
|
+
title="description of icon"
|
|
711
|
+
/>
|
|
712
|
+
</IconSettings>
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
export default Example;
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Base: Standard (custom styles)
|
|
721
|
+
|
|
722
|
+
```jsx
|
|
723
|
+
const BaseStandardCustomStyles = () => (
|
|
724
|
+
<Icon
|
|
725
|
+
assistiveText={{
|
|
726
|
+
label: 'Account',
|
|
727
|
+
}}
|
|
728
|
+
category="standard"
|
|
729
|
+
name="account"
|
|
730
|
+
style={{
|
|
731
|
+
backgroundColor: '#aceace',
|
|
732
|
+
fill: 'orangered',
|
|
733
|
+
}}
|
|
734
|
+
title="This is a title"
|
|
735
|
+
/>
|
|
736
|
+
);
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
### Base: Imported
|
|
740
|
+
|
|
741
|
+
```jsx
|
|
742
|
+
const BaseImported = () => (
|
|
743
|
+
<Icon
|
|
744
|
+
assistiveText={{
|
|
745
|
+
label: 'Download',
|
|
746
|
+
}}
|
|
747
|
+
category="utility"
|
|
748
|
+
icon={download}
|
|
749
|
+
/>
|
|
750
|
+
);
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
### Product Themes
|
|
754
|
+
|
|
755
|
+
`product-themes.jsx` (from `components/icon/__examples__/product-themes.jsx`):
|
|
756
|
+
|
|
757
|
+
```jsx
|
|
758
|
+
import React from 'react';
|
|
759
|
+
|
|
760
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
761
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
762
|
+
|
|
763
|
+
class Example extends React.Component {
|
|
764
|
+
static displayName = 'IconProductThemesExample';
|
|
765
|
+
|
|
766
|
+
render() {
|
|
767
|
+
return (
|
|
768
|
+
<IconSettings iconPath="/assets/icons">
|
|
769
|
+
<div className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
|
|
770
|
+
<div className="slds-col_padded">
|
|
771
|
+
<Icon
|
|
772
|
+
assistiveText={{ label: 'Global Setup' }}
|
|
773
|
+
category="standard"
|
|
774
|
+
name="account"
|
|
775
|
+
style={{ backgroundColor: '#2A739E' }}
|
|
776
|
+
/>
|
|
777
|
+
</div>
|
|
778
|
+
<div className="slds-col_padded">
|
|
779
|
+
<Icon
|
|
780
|
+
assistiveText={{ label: 'Service Cloud' }}
|
|
781
|
+
category="standard"
|
|
782
|
+
name="address"
|
|
783
|
+
style={{ backgroundColor: '#7f2443' }}
|
|
784
|
+
/>
|
|
785
|
+
</div>
|
|
786
|
+
<div className="slds-col_padded">
|
|
787
|
+
<Icon
|
|
788
|
+
assistiveText={{ label: 'Industry Cloud' }}
|
|
789
|
+
category="standard"
|
|
790
|
+
name="answer_best"
|
|
791
|
+
style={{ backgroundColor: '#4c2248' }}
|
|
792
|
+
/>
|
|
793
|
+
</div>
|
|
794
|
+
<div className="slds-col_padded">
|
|
795
|
+
<Icon
|
|
796
|
+
assistiveText={{ label: 'Sales Cloud' }}
|
|
797
|
+
category="standard"
|
|
798
|
+
name="canvas"
|
|
799
|
+
style={{ backgroundColor: '#00857d' }}
|
|
800
|
+
/>
|
|
801
|
+
</div>
|
|
802
|
+
<div className="slds-col_padded">
|
|
803
|
+
<Icon
|
|
804
|
+
assistiveText={{ label: 'Commerce Cloud' }}
|
|
805
|
+
category="standard"
|
|
806
|
+
name="choice"
|
|
807
|
+
style={{ backgroundColor: '#41693d' }}
|
|
808
|
+
/>
|
|
809
|
+
</div>
|
|
810
|
+
<div className="slds-col_padded">
|
|
811
|
+
<Icon
|
|
812
|
+
assistiveText={{ label: 'Community Cloud' }}
|
|
813
|
+
category="standard"
|
|
814
|
+
name="choice"
|
|
815
|
+
style={{ backgroundColor: '#ffc20e' }}
|
|
816
|
+
/>
|
|
817
|
+
</div>
|
|
818
|
+
<div className="slds-col_padded">
|
|
819
|
+
<Icon
|
|
820
|
+
assistiveText={{ label: 'Marketing Cloud' }}
|
|
821
|
+
category="standard"
|
|
822
|
+
name="choice"
|
|
823
|
+
style={{ backgroundColor: '#ea7600' }}
|
|
824
|
+
/>
|
|
825
|
+
</div>
|
|
826
|
+
<div className="slds-col_padded">
|
|
827
|
+
<Icon
|
|
828
|
+
assistiveText={{ label: 'Quip' }}
|
|
829
|
+
category="standard"
|
|
830
|
+
name="choice"
|
|
831
|
+
style={{ backgroundColor: '#cf451d' }}
|
|
832
|
+
/>
|
|
833
|
+
</div>
|
|
834
|
+
</div>
|
|
835
|
+
</IconSettings>
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
export default Example;
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
### Docs site Categories
|
|
844
|
+
|
|
845
|
+
`categories.jsx` (from `components/icon/__examples__/categories.jsx`):
|
|
846
|
+
|
|
847
|
+
```jsx
|
|
848
|
+
import React from 'react';
|
|
849
|
+
|
|
850
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
851
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
852
|
+
|
|
853
|
+
class Example extends React.Component {
|
|
854
|
+
static displayName = 'IconExample';
|
|
855
|
+
|
|
856
|
+
render() {
|
|
857
|
+
return (
|
|
858
|
+
<IconSettings iconPath="/assets/icons">
|
|
859
|
+
<div className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
|
|
860
|
+
<div className="slds-col_padded">
|
|
861
|
+
<Icon
|
|
862
|
+
assistiveText={{ label: 'Account' }}
|
|
863
|
+
category="standard"
|
|
864
|
+
name="account"
|
|
865
|
+
size="small"
|
|
866
|
+
/>
|
|
867
|
+
</div>
|
|
868
|
+
<div className="slds-col_padded">
|
|
869
|
+
<Icon
|
|
870
|
+
assistiveText={{ label: 'Announcement' }}
|
|
871
|
+
category="utility"
|
|
872
|
+
name="announcement"
|
|
873
|
+
size="small"
|
|
874
|
+
/>
|
|
875
|
+
</div>
|
|
876
|
+
<div className="slds-col_padded">
|
|
877
|
+
<Icon
|
|
878
|
+
assistiveText={{ label: 'Description' }}
|
|
879
|
+
category="action"
|
|
880
|
+
name="description"
|
|
881
|
+
size="small"
|
|
882
|
+
/>
|
|
883
|
+
</div>
|
|
884
|
+
<div className="slds-col_padded">
|
|
885
|
+
<Icon
|
|
886
|
+
assistiveText={{ label: 'XML' }}
|
|
887
|
+
category="doctype"
|
|
888
|
+
name="xml"
|
|
889
|
+
size="small"
|
|
890
|
+
/>
|
|
891
|
+
</div>
|
|
892
|
+
<div className="slds-col_padded">
|
|
893
|
+
<Icon
|
|
894
|
+
assistiveText={{ label: 'custom5' }}
|
|
895
|
+
category="custom"
|
|
896
|
+
name="custom5"
|
|
897
|
+
size="small"
|
|
898
|
+
/>
|
|
899
|
+
</div>
|
|
900
|
+
</div>
|
|
901
|
+
</IconSettings>
|
|
902
|
+
);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export default Example;
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
### Docs site Colors
|
|
910
|
+
|
|
911
|
+
`colors.jsx` (from `components/icon/__examples__/colors.jsx`):
|
|
912
|
+
|
|
913
|
+
```jsx
|
|
914
|
+
import React from 'react';
|
|
915
|
+
|
|
916
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
917
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
918
|
+
|
|
919
|
+
class Example extends React.Component {
|
|
920
|
+
static displayName = 'IconExample';
|
|
921
|
+
|
|
922
|
+
render() {
|
|
923
|
+
return (
|
|
924
|
+
<IconSettings iconPath="/assets/icons">
|
|
925
|
+
<div className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
|
|
926
|
+
<div className="slds-col_padded">
|
|
927
|
+
<Icon
|
|
928
|
+
assistiveText={{ label: 'Lead' }}
|
|
929
|
+
category="standard"
|
|
930
|
+
colorVariant="base"
|
|
931
|
+
name="lead"
|
|
932
|
+
/>
|
|
933
|
+
</div>
|
|
934
|
+
<div className="slds-col_padded">
|
|
935
|
+
<Icon
|
|
936
|
+
assistiveText={{ label: 'Lock' }}
|
|
937
|
+
category="utility"
|
|
938
|
+
colorVariant="default"
|
|
939
|
+
name="lock"
|
|
940
|
+
/>
|
|
941
|
+
</div>
|
|
942
|
+
<div className="slds-col_padded">
|
|
943
|
+
<Icon
|
|
944
|
+
assistiveText={{ label: 'Lock' }}
|
|
945
|
+
category="utility"
|
|
946
|
+
colorVariant="light"
|
|
947
|
+
name="lock"
|
|
948
|
+
/>
|
|
949
|
+
</div>
|
|
950
|
+
<div className="slds-col_padded">
|
|
951
|
+
<Icon
|
|
952
|
+
assistiveText={{ label: 'Success' }}
|
|
953
|
+
category="utility"
|
|
954
|
+
colorVariant="success"
|
|
955
|
+
name="success"
|
|
956
|
+
/>
|
|
957
|
+
</div>
|
|
958
|
+
<div className="slds-col_padded">
|
|
959
|
+
<Icon
|
|
960
|
+
assistiveText={{ label: 'Warning' }}
|
|
961
|
+
category="utility"
|
|
962
|
+
colorVariant="warning"
|
|
963
|
+
name="warning"
|
|
964
|
+
/>
|
|
965
|
+
</div>
|
|
966
|
+
<div className="slds-col_padded">
|
|
967
|
+
<Icon
|
|
968
|
+
assistiveText={{ label: 'Warning' }}
|
|
969
|
+
category="utility"
|
|
970
|
+
colorVariant="error"
|
|
971
|
+
name="error"
|
|
972
|
+
/>
|
|
973
|
+
</div>
|
|
974
|
+
</div>
|
|
975
|
+
</IconSettings>
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
export default Example;
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
### Docs site Sizes
|
|
984
|
+
|
|
985
|
+
`sizes.jsx` (from `components/icon/__examples__/sizes.jsx`):
|
|
986
|
+
|
|
987
|
+
```jsx
|
|
988
|
+
import React from 'react';
|
|
989
|
+
|
|
990
|
+
import IconSettings from '@salesforce/design-system-react/components/icon-settings';
|
|
991
|
+
import Icon from '@salesforce/design-system-react/components/icon';
|
|
992
|
+
|
|
993
|
+
class Example extends React.Component {
|
|
994
|
+
static displayName = 'IconExample';
|
|
995
|
+
|
|
996
|
+
render() {
|
|
997
|
+
return (
|
|
998
|
+
<IconSettings iconPath="/assets/icons">
|
|
999
|
+
<div className="slds-grid slds-grid_pull-padded slds-grid_vertical-align-center">
|
|
1000
|
+
<div className="slds-col_padded">
|
|
1001
|
+
<Icon
|
|
1002
|
+
assistiveText={{ label: 'Warning' }}
|
|
1003
|
+
category="utility"
|
|
1004
|
+
color="warning"
|
|
1005
|
+
name="warning"
|
|
1006
|
+
size="x-small"
|
|
1007
|
+
/>
|
|
1008
|
+
</div>
|
|
1009
|
+
<div className="slds-col_padded">
|
|
1010
|
+
<Icon
|
|
1011
|
+
assistiveText={{ label: 'Case' }}
|
|
1012
|
+
category="standard"
|
|
1013
|
+
name="case"
|
|
1014
|
+
size="small"
|
|
1015
|
+
/>
|
|
1016
|
+
</div>
|
|
1017
|
+
<div className="slds-col_padded">
|
|
1018
|
+
<Icon
|
|
1019
|
+
assistiveText={{ label: 'Case' }}
|
|
1020
|
+
category="standard"
|
|
1021
|
+
name="case"
|
|
1022
|
+
size="medium"
|
|
1023
|
+
/>
|
|
1024
|
+
</div>
|
|
1025
|
+
<div className="slds-col_padded">
|
|
1026
|
+
<Icon
|
|
1027
|
+
assistiveText={{ label: 'Case' }}
|
|
1028
|
+
category="standard"
|
|
1029
|
+
name="case"
|
|
1030
|
+
size="large"
|
|
1031
|
+
/>
|
|
1032
|
+
</div>
|
|
1033
|
+
</div>
|
|
1034
|
+
</IconSettings>
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
export default Example;
|
|
1040
|
+
```
|