@react-ui-org/react-ui 0.52.1 → 0.53.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CODEOWNERS +23 -0
- package/README.md +10 -7
- package/dist/react-ui.css +5 -3
- package/dist/react-ui.js +1 -1
- package/package.json +64 -77
- package/src/{lib/components → components}/Alert/Alert.jsx +1 -1
- package/src/{lib/components/Alert/README.mdx → components/Alert/README.md} +84 -100
- package/src/{lib/components → components}/Badge/Badge.jsx +1 -1
- package/src/{lib/components → components}/Badge/Badge.scss +1 -1
- package/src/components/Badge/README.md +103 -0
- package/src/{lib/components → components}/Button/Button.jsx +1 -1
- package/src/components/Button/README.md +580 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroup.jsx +11 -9
- package/src/{lib/components/ButtonGroup/README.mdx → components/ButtonGroup/README.md} +128 -134
- package/src/{lib/components → components}/Card/Card.jsx +1 -1
- package/src/components/Card/README.md +314 -0
- package/src/{lib/components/CheckboxField/README.mdx → components/CheckboxField/README.md} +96 -108
- package/src/{lib/components/FileInputField/README.mdx → components/FileInputField/README.md} +83 -95
- package/src/{lib/components → components}/FormLayout/FormLayout.jsx +4 -4
- package/src/components/FormLayout/README.md +462 -0
- package/src/{lib/components → components}/Grid/Grid.jsx +2 -2
- package/src/components/Grid/README.md +281 -0
- package/src/{lib/components → components}/InputGroup/InputGroup.jsx +20 -19
- package/src/{lib/components → components}/InputGroup/InputGroup.scss +0 -5
- package/src/{lib/components/InputGroup/README.mdx → components/InputGroup/README.md} +145 -163
- package/src/{lib/components → components}/Modal/Modal.jsx +6 -6
- package/src/components/Modal/README.md +1090 -0
- package/src/components/Modal/_hooks/useModalScrollPrevention.js +37 -0
- package/src/{lib/components/Paper/README.mdx → components/Paper/README.md} +18 -30
- package/src/{lib/components/Popover/README.mdx → components/Popover/README.md} +102 -132
- package/src/{lib/components/Radio/README.mdx → components/Radio/README.md} +122 -134
- package/src/{lib/components → components}/Radio/Radio.jsx +11 -12
- package/src/{lib/components → components}/Radio/Radio.scss +0 -5
- package/src/components/ScrollView/README.md +503 -0
- package/src/{lib/components → components}/ScrollView/ScrollView.jsx +12 -3
- package/src/components/SelectField/README.md +681 -0
- package/src/components/Table/README.md +259 -0
- package/src/{lib/components → components}/Table/Table.jsx +4 -1
- package/src/{lib/components → components}/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
- package/src/{lib/components/Tabs/README.mdx → components/Tabs/README.md} +117 -134
- package/src/{lib/components → components}/Tabs/TabsItem.jsx +3 -3
- package/src/components/Text/README.md +220 -0
- package/src/components/TextArea/README.md +359 -0
- package/src/{lib/components/TextField/README.mdx → components/TextField/README.md} +336 -342
- package/src/{lib/components/TextLink/README.mdx → components/TextLink/README.md} +19 -31
- package/src/{lib/components/Toggle/README.mdx → components/Toggle/README.md} +98 -110
- package/src/components/Toolbar/README.md +359 -0
- package/src/{lib/components → components}/Toolbar/_helpers/getAlignClassName.js +12 -4
- package/src/components/_helpers/getRootPriorityClassName.js +15 -0
- package/src/{lib/index.js → index.js} +6 -0
- package/src/{lib/provider → provider}/RUIProvider.jsx +17 -11
- package/src/{lib/styles → styles}/tools/_caret.scss +1 -1
- package/src/{lib/styles → styles}/tools/form-fields/_box-field-elements.scss +1 -1
- package/src/{lib/styles → styles}/tools/form-fields/_inline-field-elements.scss +2 -2
- package/src/{lib/theme.scss → theme.scss} +4 -3
- package/CONTRIBUTING.md +0 -137
- package/dist/lib.development.js +0 -3179
- package/dist/lib.js +0 -1
- package/public/racom.svg +0 -11
- package/src/lib/components/Badge/README.mdx +0 -126
- package/src/lib/components/Button/README.mdx +0 -581
- package/src/lib/components/Card/README.mdx +0 -326
- package/src/lib/components/FormLayout/README.mdx +0 -501
- package/src/lib/components/Grid/README.mdx +0 -299
- package/src/lib/components/Modal/README.mdx +0 -1360
- package/src/lib/components/Modal/_hooks/useModalScrollPrevention.js +0 -35
- package/src/lib/components/ScrollView/README.mdx +0 -521
- package/src/lib/components/SelectField/README.mdx +0 -693
- package/src/lib/components/Table/README.mdx +0 -275
- package/src/lib/components/Text/README.mdx +0 -241
- package/src/lib/components/TextArea/README.mdx +0 -366
- package/src/lib/components/Toolbar/README.mdx +0 -386
- package/src/{lib/components → components}/Alert/Alert.scss +0 -0
- package/src/{lib/components → components}/Alert/_settings.scss +0 -0
- package/src/{lib/components → components}/Alert/_theme.scss +0 -0
- package/src/{lib/components → components}/Alert/_tools.scss +0 -0
- package/src/{lib/components → components}/Alert/index.js +0 -0
- package/src/{lib/components → components}/Badge/index.js +0 -0
- package/src/{lib/components → components}/Button/Button.scss +0 -0
- package/src/{lib/components → components}/Button/_base.scss +0 -0
- package/src/{lib/components → components}/Button/_priorities.scss +0 -0
- package/src/{lib/components → components}/Button/_settings.scss +0 -0
- package/src/{lib/components → components}/Button/_theme.scss +0 -0
- package/src/{lib/components → components}/Button/_tools.scss +0 -0
- package/src/{lib/components → components}/Button/helpers/getRootLabelVisibilityClassName.js +0 -0
- package/src/{lib/components/_helpers → components/Button/helpers}/getRootPriorityClassName.js +0 -0
- package/src/{lib/components → components}/Button/index.js +0 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroup.scss +0 -0
- package/src/{lib/components → components}/ButtonGroup/ButtonGroupContext.js +0 -0
- package/src/{lib/components → components}/ButtonGroup/_theme.scss +0 -0
- package/src/{lib/components → components}/ButtonGroup/index.js +0 -0
- package/src/{lib/components → components}/Card/Card.scss +0 -0
- package/src/{lib/components → components}/Card/CardBody.jsx +0 -0
- package/src/{lib/components → components}/Card/CardFooter.jsx +0 -0
- package/src/{lib/components → components}/Card/_theme.scss +0 -0
- package/src/{lib/components → components}/Card/_tools.scss +0 -0
- package/src/{lib/components → components}/Card/index.js +0 -0
- package/src/{lib/components → components}/CheckboxField/CheckboxField.jsx +0 -0
- package/src/{lib/components → components}/CheckboxField/CheckboxField.scss +0 -0
- package/src/{lib/components → components}/CheckboxField/index.js +0 -0
- package/src/{lib/components → components}/FileInputField/FileInputField.jsx +0 -0
- package/src/{lib/components → components}/FileInputField/FileInputField.scss +0 -0
- package/src/{lib/components → components}/FileInputField/index.js +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayout.scss +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayoutContext.js +0 -0
- package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.jsx +4 -4
- package/src/{lib/components → components}/FormLayout/FormLayoutCustomField.scss +0 -0
- package/src/{lib/components → components}/FormLayout/_theme.scss +0 -0
- package/src/{lib/components → components}/FormLayout/index.js +0 -0
- package/src/{lib/components → components}/Grid/Grid.scss +0 -0
- package/src/{lib/components → components}/Grid/GridSpan.jsx +0 -0
- package/src/{lib/components → components}/Grid/_helpers/generateResponsiveCustomProperties.js +0 -0
- package/src/{lib/components → components}/Grid/_settings.scss +0 -0
- package/src/{lib/components → components}/Grid/_tools.scss +0 -0
- package/src/{lib/components → components}/Grid/index.js +0 -0
- package/src/{lib/components → components}/InputGroup/InputGroupContext.js +0 -0
- package/src/{lib/components → components}/InputGroup/_theme.scss +0 -0
- package/src/{lib/components → components}/InputGroup/index.js +0 -0
- package/src/{lib/components → components}/Modal/Modal.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalBody.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalBody.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalCloseButton.jsx +1 -1
- package/src/{lib/components → components}/Modal/ModalCloseButton.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalContent.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalContent.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalFooter.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalFooter.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalHeader.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalHeader.scss +0 -0
- package/src/{lib/components → components}/Modal/ModalTitle.jsx +0 -0
- package/src/{lib/components → components}/Modal/ModalTitle.scss +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getJustifyClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getPositionClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getScrollingClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_helpers/getSizeClassName.js +0 -0
- package/src/{lib/components → components}/Modal/_hooks/useModalFocus.js +0 -0
- package/src/{lib/components → components}/Modal/_settings.scss +0 -0
- package/src/{lib/components → components}/Modal/_theme.scss +0 -0
- package/src/{lib/components → components}/Modal/index.js +0 -0
- package/src/{lib/components → components}/Paper/Paper.jsx +0 -0
- package/src/{lib/components → components}/Paper/Paper.scss +0 -0
- package/src/{lib/components → components}/Paper/_theme.scss +0 -0
- package/src/{lib/components → components}/Paper/index.js +0 -0
- package/src/{lib/components → components}/Popover/Popover.jsx +0 -0
- package/src/{lib/components → components}/Popover/Popover.scss +0 -0
- package/src/{lib/components → components}/Popover/PopoverWrapper.jsx +0 -0
- package/src/{lib/components → components}/Popover/PopoverWrapper.scss +0 -0
- package/src/{lib/components → components}/Popover/_helpers/getRootAlignmentClassName.js +0 -0
- package/src/{lib/components → components}/Popover/_helpers/getRootSideClassName.js +0 -0
- package/src/{lib/components → components}/Popover/_theme.scss +0 -0
- package/src/{lib/components → components}/Popover/index.js +0 -0
- package/src/{lib/components → components}/Radio/index.js +0 -0
- package/src/{lib/components → components}/ScrollView/ScrollView.scss +0 -0
- package/src/{lib/components → components}/ScrollView/_helpers/getElementsPositionDifference.js +0 -0
- package/src/{lib/components → components}/ScrollView/_hooks/useLoadResizeHook.js +0 -0
- package/src/{lib/components → components}/ScrollView/_hooks/useScrollPositionHook.js +0 -0
- package/src/{lib/components → components}/ScrollView/index.js +0 -0
- package/src/{lib/components → components}/SelectField/SelectField.jsx +0 -0
- package/src/{lib/components → components}/SelectField/SelectField.scss +0 -0
- package/src/{lib/components → components}/SelectField/_components/Option/Option.jsx +0 -0
- package/src/{lib/components → components}/SelectField/_components/Option/index.js +0 -0
- package/src/{lib/components → components}/SelectField/index.js +0 -0
- package/src/{lib/components → components}/Table/Table.scss +0 -0
- package/src/{lib/components → components}/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -0
- package/src/{lib/components → components}/Table/_components/TableBodyCell/index.js +0 -0
- package/src/{lib/components → components}/Table/_components/TableCell.scss +0 -0
- package/src/{lib/components → components}/Table/_components/TableHeaderCell/index.js +0 -0
- package/src/{lib/components → components}/Table/_settings.scss +0 -0
- package/src/{lib/components → components}/Table/index.js +0 -0
- package/src/{lib/components → components}/Tabs/Tabs.jsx +0 -0
- package/src/{lib/components → components}/Tabs/Tabs.scss +0 -0
- package/src/{lib/components → components}/Tabs/TabsItem.scss +0 -0
- package/src/{lib/components → components}/Tabs/_theme.scss +0 -0
- package/src/{lib/components → components}/Tabs/index.js +0 -0
- package/src/{lib/components → components}/Text/Text.jsx +0 -0
- package/src/{lib/components → components}/Text/Text.scss +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootClampClassName.js +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootHyphensClassName.js +0 -0
- package/src/{lib/components → components}/Text/_helpers/getRootWordWrappingClassName.js +0 -0
- package/src/{lib/components → components}/Text/index.js +0 -0
- package/src/{lib/components → components}/TextArea/TextArea.jsx +0 -0
- package/src/{lib/components → components}/TextArea/TextArea.scss +0 -0
- package/src/{lib/components → components}/TextArea/index.js +0 -0
- package/src/{lib/components → components}/TextField/TextField.jsx +0 -0
- package/src/{lib/components → components}/TextField/TextField.scss +0 -0
- package/src/{lib/components → components}/TextField/index.js +0 -0
- package/src/{lib/components → components}/TextLink/TextLink.jsx +1 -1
- /package/src/{lib/components → components}/TextLink/TextLink.scss +0 -0
- /package/src/{lib/components → components}/TextLink/_theme.scss +0 -0
- /package/src/{lib/components → components}/TextLink/index.js +0 -0
- /package/src/{lib/components → components}/Toggle/Toggle.jsx +0 -0
- /package/src/{lib/components → components}/Toggle/Toggle.scss +0 -0
- /package/src/{lib/components → components}/Toggle/index.js +0 -0
- /package/src/{lib/components → components}/Toolbar/Toolbar.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/Toolbar.scss +0 -0
- /package/src/{lib/components → components}/Toolbar/ToolbarGroup.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/ToolbarItem.jsx +0 -0
- /package/src/{lib/components → components}/Toolbar/_helpers/getJustifyClassName.js +0 -0
- /package/src/{lib/components → components}/Toolbar/_theme.scss +0 -0
- /package/src/{lib/components → components}/Toolbar/index.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootColorClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootSizeClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/getRootValidationStateClassName.js +0 -0
- /package/src/{lib/components → components}/_helpers/isChildrenEmpty.js +0 -0
- /package/src/{lib/components → components}/_helpers/resolveContextOrProp.js +0 -0
- /package/src/{lib/components → components}/_helpers/transferProps.js +0 -0
- /package/src/{lib/foundation.scss → foundation.scss} +0 -0
- /package/src/{lib/helpers.scss → helpers.scss} +0 -0
- /package/src/{lib/provider → provider}/RUIContext.jsx +0 -0
- /package/src/{lib/provider → provider}/index.js +0 -0
- /package/src/{lib/provider → provider}/withGlobalProps.jsx +0 -0
- /package/src/{lib/styles → styles}/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_code.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_links.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_lists.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_page.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_rulers.scss +0 -0
- /package/src/{lib/styles → styles}/elements/_small.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_box-sizing.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_focus.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_forms.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_reset.scss +0 -0
- /package/src/{lib/styles → styles}/generic/_shared.scss +0 -0
- /package/src/{lib/styles → styles}/helpers/_animation.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_animations.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_breakpoints.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_escaped-characters.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_form-fields.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_forms.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/settings/_z-indexes.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_accessibility.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_borders.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_code.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_form-fields.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_links.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_lists.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_page.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_spacing.scss +0 -0
- /package/src/{lib/styles → styles}/theme/_typography.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_breakpoints.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_colors.scss +0 -0
- /package/src/{lib/styles → styles}/theme-constants/_svg.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_accessibility.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_breakpoint.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_colors.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_reset.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_scrollbar.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_spacing.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_string.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_svg.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_transition.scss +0 -0
- /package/src/{lib/styles → styles}/tools/_utilities.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_box-field-layout.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_box-field-sizes.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_foundation.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_inline-field-layout.scss +0 -0
- /package/src/{lib/styles → styles}/tools/form-fields/_variants.scss +0 -0
- /package/src/{lib/translations → translations}/en.js +0 -0
- /package/src/{lib/utils → utils}/classNames.js +0 -0
@@ -1,581 +0,0 @@
|
|
1
|
-
---
|
2
|
-
name: Button
|
3
|
-
menu: 'Actions'
|
4
|
-
route: /components/button
|
5
|
-
---
|
6
|
-
|
7
|
-
# Button
|
8
|
-
|
9
|
-
import {
|
10
|
-
Playground,
|
11
|
-
Props,
|
12
|
-
} from 'docz'
|
13
|
-
import Icon from '../../../docs/_components/Icon'
|
14
|
-
import Placeholder from '../../../docs/_components/Placeholder'
|
15
|
-
import {
|
16
|
-
Badge,
|
17
|
-
Button,
|
18
|
-
} from '../..'
|
19
|
-
|
20
|
-
Buttons allow users to take actions.
|
21
|
-
|
22
|
-
## Basic Usage
|
23
|
-
|
24
|
-
To implement the Button component, you need to import it first:
|
25
|
-
|
26
|
-
```js
|
27
|
-
import { Button } from '@react-ui-org/react-ui';
|
28
|
-
```
|
29
|
-
|
30
|
-
And use it:
|
31
|
-
|
32
|
-
<Playground>
|
33
|
-
<Button label="My button" />
|
34
|
-
</Playground>
|
35
|
-
|
36
|
-
See [API](#api) for all available options.
|
37
|
-
|
38
|
-
## General Guidelines
|
39
|
-
|
40
|
-
- Use **short yet comprehensible labels** to make buttons fit small screens.
|
41
|
-
|
42
|
-
- Since buttons are there to take actions, **use a verb** to make it obvious
|
43
|
-
what your buttons do.
|
44
|
-
|
45
|
-
- **Don't overwhelm your UI** with too many high-emphasis actions. There should
|
46
|
-
always be one but chances are that having more of them is not necessary.
|
47
|
-
|
48
|
-
## Priorities
|
49
|
-
|
50
|
-
There are three **visual priorities** of buttons to choose from, from highest to
|
51
|
-
lowest:
|
52
|
-
|
53
|
-
1. filled
|
54
|
-
2. outline
|
55
|
-
3. flat
|
56
|
-
|
57
|
-
All priorities come in supported
|
58
|
-
[component colors](/foundation/colors#component-colors).
|
59
|
-
|
60
|
-
### Filled
|
61
|
-
|
62
|
-
The default, high-emphasis priority should be used for primary actions of your
|
63
|
-
app. Use it sparingly but remember there should always be one on a screen.
|
64
|
-
|
65
|
-
<Playground>
|
66
|
-
<Button label="Primary" />
|
67
|
-
<Button label="Secondary" color="secondary" />
|
68
|
-
<Button label="Selected" color="selected" />
|
69
|
-
<Button label="Success" color="success" />
|
70
|
-
<Button label="Warning" color="warning" />
|
71
|
-
<Button label="Danger" color="danger" />
|
72
|
-
<Button label="Help" color="help" />
|
73
|
-
<Button label="Info" color="info" />
|
74
|
-
<Button label="Note" color="note" />
|
75
|
-
<Placeholder dark inline>
|
76
|
-
<Button label="Light" color="light" />
|
77
|
-
</Placeholder>
|
78
|
-
<Button label="Dark" color="dark" />
|
79
|
-
</Playground>
|
80
|
-
|
81
|
-
Default, unconfigured button comes in **medium** size, **filled** visual
|
82
|
-
priority, and **primary** color variant.
|
83
|
-
|
84
|
-
### Outline
|
85
|
-
|
86
|
-
Medium-emphasis buttons. They are designed to contain actions that are
|
87
|
-
important but not primary in your app.
|
88
|
-
|
89
|
-
<Playground>
|
90
|
-
<Button priority="outline" label="Primary" />
|
91
|
-
<Button priority="outline" label="Secondary" color="secondary" />
|
92
|
-
<Button priority="outline" label="Selected" color="selected" />
|
93
|
-
<Button priority="outline" label="Success" color="success" />
|
94
|
-
<Button priority="outline" label="Warning" color="warning" />
|
95
|
-
<Button priority="outline" label="Danger" color="danger" />
|
96
|
-
<Button priority="outline" label="Help" color="help" />
|
97
|
-
<Button priority="outline" label="Info" color="info" />
|
98
|
-
<Button priority="outline" label="Note" color="note" />
|
99
|
-
<Placeholder dark inline>
|
100
|
-
<Button priority="outline" label="Light" color="light" />
|
101
|
-
</Placeholder>
|
102
|
-
<Button priority="outline" label="Dark" color="dark" />
|
103
|
-
</Playground>
|
104
|
-
|
105
|
-
### Flat
|
106
|
-
|
107
|
-
Flat buttons are designed for less pronounced actions to help maintain focus on
|
108
|
-
the content.
|
109
|
-
|
110
|
-
<Playground>
|
111
|
-
<Button priority="flat" label="Primary" />
|
112
|
-
<Button priority="flat" label="Secondary" color="secondary" />
|
113
|
-
<Button priority="flat" label="Selected" color="selected" />
|
114
|
-
<Button priority="flat" label="Success" color="success" />
|
115
|
-
<Button priority="flat" label="Warning" color="warning" />
|
116
|
-
<Button priority="flat" label="Danger" color="danger" />
|
117
|
-
<Button priority="flat" label="Help" color="help" />
|
118
|
-
<Button priority="flat" label="Info" color="info" />
|
119
|
-
<Button priority="flat" label="Note" color="note" />
|
120
|
-
<Placeholder dark inline>
|
121
|
-
<Button priority="flat" label="Light" color="light" />
|
122
|
-
</Placeholder>
|
123
|
-
<Button priority="flat" label="Dark" color="dark" />
|
124
|
-
</Playground>
|
125
|
-
|
126
|
-
## Sizes
|
127
|
-
|
128
|
-
Aside from the default (medium) size, two additional sizes are available: small
|
129
|
-
and large.
|
130
|
-
|
131
|
-
<Playground>
|
132
|
-
<Button label="Small" size="small" />
|
133
|
-
<Button label="Medium" />
|
134
|
-
<Button label="Large" size="large" />
|
135
|
-
</Playground>
|
136
|
-
|
137
|
-
Block buttons span the full width of a parent:
|
138
|
-
|
139
|
-
<Playground>
|
140
|
-
<Button label="Block button" block />
|
141
|
-
</Playground>
|
142
|
-
|
143
|
-
## Buttons with Icons
|
144
|
-
|
145
|
-
To improve clarity or to draw attention to the action, icons can be added
|
146
|
-
before or after the button's label.
|
147
|
-
|
148
|
-
👉 Please note there are no icons pre-packed in React UI. Visit
|
149
|
-
[Icons](/foundation/icons) to see how to include them.
|
150
|
-
|
151
|
-
<Playground>
|
152
|
-
<Button
|
153
|
-
label="Icon before label"
|
154
|
-
beforeLabel={<Icon icon="star" />}
|
155
|
-
/>
|
156
|
-
<Button
|
157
|
-
label="Icon after label"
|
158
|
-
afterLabel={<Icon icon="star" />}
|
159
|
-
/>
|
160
|
-
</Playground>
|
161
|
-
|
162
|
-
### Icon Buttons
|
163
|
-
|
164
|
-
For clear and simple actions, buttons can visually consist just of an icon.
|
165
|
-
Label remains mandatory to keep the button accessible.
|
166
|
-
|
167
|
-
<Playground>
|
168
|
-
<Button
|
169
|
-
label="Icon button"
|
170
|
-
labelVisibility="none"
|
171
|
-
beforeLabel={<Icon icon="pencil" />}
|
172
|
-
/>
|
173
|
-
</Playground>
|
174
|
-
|
175
|
-
Icon buttons can optionally enhance on a [breakpoint](/foundation/breakpoints)
|
176
|
-
of your choice and display label once you know there is enough room for it.
|
177
|
-
|
178
|
-
📐 Try resizing your browser to see how label visibility changes.
|
179
|
-
|
180
|
-
<Playground>
|
181
|
-
<Button
|
182
|
-
label="Label visible from sm up"
|
183
|
-
labelVisibility="sm"
|
184
|
-
beforeLabel={<Icon icon="pencil" />}
|
185
|
-
/>
|
186
|
-
<Button
|
187
|
-
label="Label visible from md up"
|
188
|
-
labelVisibility="md"
|
189
|
-
beforeLabel={<Icon icon="pencil" />}
|
190
|
-
/>
|
191
|
-
<Button
|
192
|
-
label="Label visible from lg up"
|
193
|
-
labelVisibility="lg"
|
194
|
-
beforeLabel={<Icon icon="pencil" />}
|
195
|
-
/>
|
196
|
-
<Button
|
197
|
-
label="Label visible from xl up"
|
198
|
-
labelVisibility="xl"
|
199
|
-
beforeLabel={<Icon icon="pencil" />}
|
200
|
-
/>
|
201
|
-
<Button
|
202
|
-
label="Label visible from x2l up"
|
203
|
-
labelVisibility="x2l"
|
204
|
-
beforeLabel={<Icon icon="pencil" />}
|
205
|
-
/>
|
206
|
-
<Button
|
207
|
-
label="Label visible from x3l up"
|
208
|
-
labelVisibility="x3l"
|
209
|
-
beforeLabel={<Icon icon="pencil" />}
|
210
|
-
/>
|
211
|
-
</Playground>
|
212
|
-
|
213
|
-
## Buttons with Badges
|
214
|
-
|
215
|
-
A [Badge](/components/badge) can be added to buttons to provide additional
|
216
|
-
information or to draw user's attention.
|
217
|
-
|
218
|
-
<Playground>
|
219
|
-
<Button
|
220
|
-
label="Badge before"
|
221
|
-
beforeLabel={<Badge label={3} priority="outline" color="light" />}
|
222
|
-
/>
|
223
|
-
<Button
|
224
|
-
label="Badge before, on top"
|
225
|
-
startCorner={<Badge label={3} />}
|
226
|
-
/>
|
227
|
-
<Button
|
228
|
-
label="Badge after, on top"
|
229
|
-
endCorner={<Badge label={3} />}
|
230
|
-
priority="outline"
|
231
|
-
/>
|
232
|
-
<Button
|
233
|
-
label="Badge after"
|
234
|
-
afterLabel={<Badge label="new" color="warning" />}
|
235
|
-
priority="outline"
|
236
|
-
/>
|
237
|
-
</Playground>
|
238
|
-
|
239
|
-
### Icon Buttons with a Badge
|
240
|
-
|
241
|
-
Badges play nicely with icon buttons, too:
|
242
|
-
|
243
|
-
<Playground>
|
244
|
-
<Button
|
245
|
-
label="Icon button with badge"
|
246
|
-
labelVisibility="none"
|
247
|
-
priority="outline"
|
248
|
-
beforeLabel={<Icon icon="warning-sign" />}
|
249
|
-
startCorner={<Badge label={3} color="warning" />}
|
250
|
-
/>
|
251
|
-
<Button
|
252
|
-
label="Icon button with badge"
|
253
|
-
labelVisibility="md"
|
254
|
-
priority="outline"
|
255
|
-
beforeLabel={<Icon icon="warning-sign" />}
|
256
|
-
startCorner={<Badge label={3} color="danger" />}
|
257
|
-
/>
|
258
|
-
</Playground>
|
259
|
-
|
260
|
-
## States
|
261
|
-
|
262
|
-
### Disabled State
|
263
|
-
|
264
|
-
Disabled state makes the action unavailable.
|
265
|
-
|
266
|
-
<Playground>
|
267
|
-
<Button label="Disabled filled button" disabled />
|
268
|
-
<Button label="Disabled outline button" priority="outline" disabled />
|
269
|
-
<Button label="Disabled flat button" priority="flat" disabled />
|
270
|
-
</Playground>
|
271
|
-
|
272
|
-
### Feedback State
|
273
|
-
|
274
|
-
When user's action triggers an asynchronous process on background, the button's
|
275
|
-
feedback state (not to be mistaken with
|
276
|
-
[feedback colors](/foundation/colors#component-colors)) can be indicated by
|
277
|
-
showing an icon. The icon replaces button's label while retaining original
|
278
|
-
dimensions of the button. Buttons in feedback state are automatically disabled
|
279
|
-
to prevent unwanted interaction.
|
280
|
-
|
281
|
-
Filled buttons in feedback state:
|
282
|
-
|
283
|
-
<Playground>
|
284
|
-
<Button
|
285
|
-
label="Success"
|
286
|
-
color="success"
|
287
|
-
feedbackIcon={<Icon icon="success" />}
|
288
|
-
/>
|
289
|
-
<Button
|
290
|
-
label="Success"
|
291
|
-
labelVisibility="none"
|
292
|
-
color="success"
|
293
|
-
feedbackIcon={<Icon icon="success" />}
|
294
|
-
endCorner={<Badge color="danger" label={3} />}
|
295
|
-
/>
|
296
|
-
<Placeholder dark inline>
|
297
|
-
<Button
|
298
|
-
label="Light"
|
299
|
-
color="light"
|
300
|
-
feedbackIcon={<Icon icon="success" />}
|
301
|
-
/>
|
302
|
-
</Placeholder>
|
303
|
-
<Button
|
304
|
-
label="Dark"
|
305
|
-
color="dark"
|
306
|
-
feedbackIcon={<Icon icon="success" />}
|
307
|
-
/>
|
308
|
-
<Button
|
309
|
-
label="Primary"
|
310
|
-
feedbackIcon={(
|
311
|
-
<span className="d-inline-flex animation-spin-counterclockwise">
|
312
|
-
<Icon icon="loading" />
|
313
|
-
</span>
|
314
|
-
)}
|
315
|
-
/>
|
316
|
-
</Playground>
|
317
|
-
|
318
|
-
Outline buttons in feedback state:
|
319
|
-
|
320
|
-
<Playground>
|
321
|
-
<Button
|
322
|
-
label="Success"
|
323
|
-
priority="outline"
|
324
|
-
color="success"
|
325
|
-
feedbackIcon={<Icon icon="success" />}
|
326
|
-
/>
|
327
|
-
<Button
|
328
|
-
label="Success"
|
329
|
-
labelVisibility="none"
|
330
|
-
priority="outline"
|
331
|
-
color="success"
|
332
|
-
feedbackIcon={<Icon icon="success" />}
|
333
|
-
endCorner={<Badge color="danger" label={3} />}
|
334
|
-
/>
|
335
|
-
<Placeholder dark inline>
|
336
|
-
<Button
|
337
|
-
label="Light"
|
338
|
-
priority="outline"
|
339
|
-
color="light"
|
340
|
-
feedbackIcon={<Icon icon="success" />}
|
341
|
-
/>
|
342
|
-
</Placeholder>
|
343
|
-
<Button
|
344
|
-
label="Dark"
|
345
|
-
priority="outline"
|
346
|
-
color="dark"
|
347
|
-
feedbackIcon={<Icon icon="success" />}
|
348
|
-
/>
|
349
|
-
<Button
|
350
|
-
label="Primary"
|
351
|
-
priority="outline"
|
352
|
-
feedbackIcon={(
|
353
|
-
<span className="d-inline-flex animation-spin-counterclockwise">
|
354
|
-
<Icon icon="loading" />
|
355
|
-
</span>
|
356
|
-
)}
|
357
|
-
/>
|
358
|
-
</Playground>
|
359
|
-
|
360
|
-
Flat buttons in feedback state:
|
361
|
-
|
362
|
-
<Playground>
|
363
|
-
<Button
|
364
|
-
label="Success"
|
365
|
-
priority="flat"
|
366
|
-
color="success"
|
367
|
-
feedbackIcon={<Icon icon="success" />}
|
368
|
-
/>
|
369
|
-
<Button
|
370
|
-
label="Success"
|
371
|
-
labelVisibility="none"
|
372
|
-
priority="flat"
|
373
|
-
color="success"
|
374
|
-
feedbackIcon={<Icon icon="success" />}
|
375
|
-
endCorner={<Badge color="danger" label={3} />}
|
376
|
-
/>
|
377
|
-
<Placeholder dark inline>
|
378
|
-
<Button
|
379
|
-
label="Light"
|
380
|
-
priority="flat"
|
381
|
-
color="light"
|
382
|
-
feedbackIcon={<Icon icon="success" />}
|
383
|
-
/>
|
384
|
-
</Placeholder>
|
385
|
-
<Button
|
386
|
-
label="Dark"
|
387
|
-
priority="flat"
|
388
|
-
color="dark"
|
389
|
-
feedbackIcon={<Icon icon="success" />}
|
390
|
-
/>
|
391
|
-
<Button
|
392
|
-
label="Primary"
|
393
|
-
priority="flat"
|
394
|
-
feedbackIcon={(
|
395
|
-
<span className="d-inline-flex animation-spin-counterclockwise">
|
396
|
-
<Icon icon="loading" />
|
397
|
-
</span>
|
398
|
-
)}
|
399
|
-
/>
|
400
|
-
</Playground>
|
401
|
-
|
402
|
-
👉 Visit the [CSS Helpers](/css-helpers/animation) section to see how the icon
|
403
|
-
animation is made.
|
404
|
-
|
405
|
-
## Forwarding HTML Attributes
|
406
|
-
|
407
|
-
In addition to the options below in the [component's API](#api) section, you
|
408
|
-
can specify [React synthetic events] or **any HTML attribute you like.** All
|
409
|
-
attributes that don't interfere with the API are forwarded to the native HTML
|
410
|
-
`<button>`. This enables making the component interactive and helps to improve
|
411
|
-
its accessibility.
|
412
|
-
|
413
|
-
👉 Refer to the MDN reference for the full list of supported attributes of the
|
414
|
-
[button] element.
|
415
|
-
|
416
|
-
## Forwarding ref
|
417
|
-
|
418
|
-
If you provide [ref], it is forwarded to the native HTML `<button>` element.
|
419
|
-
|
420
|
-
## API
|
421
|
-
|
422
|
-
<Props table of={Button} />
|
423
|
-
|
424
|
-
## Theming
|
425
|
-
|
426
|
-
### Common Theming Options
|
427
|
-
|
428
|
-
| Custom Property | Description |
|
429
|
-
|--------------------------------|----------------------------------------------|
|
430
|
-
| `--rui-Button__font-weight` | Font weight |
|
431
|
-
| `--rui-Button__text-transform` | Text transform, e.g. uppercase or small-caps |
|
432
|
-
| `--rui-Button__letter-spacing` | Spacing between letters |
|
433
|
-
| `--rui-Button__border-width` | Border width |
|
434
|
-
| `--rui-Button__border-radius` | Corner radius |
|
435
|
-
|
436
|
-
### Theming Priorities and Color Variants
|
437
|
-
|
438
|
-
It's possible to adjust the theme for specific priority, color variant, and
|
439
|
-
state. Naming convention looks as follows:
|
440
|
-
|
441
|
-
`--rui-Button--<PRIORITY>--<COLOR>--<INTERACTION STATE>__<PROPERTY>`
|
442
|
-
|
443
|
-
Where:
|
444
|
-
|
445
|
-
- `<PRIORITY>` is one of `filled`, `outline`, or `flat` (see
|
446
|
-
[Priorities](#priorities) and [API](#api)),
|
447
|
-
- `<COLOR>` is one of supported
|
448
|
-
[component colors](/foundation/colors#component-colors)
|
449
|
-
(see color variants of [each priority](#priorities) and [API](#api)),
|
450
|
-
- `<INTERACTION STATE>` is one of `default`, `hover`, `active`, or `disabled`
|
451
|
-
(the last one being optional),
|
452
|
-
- `<PROPERTY>` is one of:
|
453
|
-
- `color`, `border-color`, `background`, or `box-shadow` for the `filled`
|
454
|
-
priority,
|
455
|
-
- `color`, `border-color`, or `background` for the `outline` priority,
|
456
|
-
- `color` or `background` for the `flat` priority.
|
457
|
-
|
458
|
-
### Theming Sizes
|
459
|
-
|
460
|
-
Available sizes can be adjusted as follows:
|
461
|
-
|
462
|
-
`--rui-Button--<SIZE>__<PROPERTY>`
|
463
|
-
|
464
|
-
Where:
|
465
|
-
|
466
|
-
- `<SIZE>` is one of `small`, `medium`, or `large` (see [Sizes](#sizes) and
|
467
|
-
[API](#api))
|
468
|
-
- `<PROPERTY>` is one of `height`, `padding-x`, `padding-y`, or `font-size`
|
469
|
-
|
470
|
-
👉 Button sizes are linked to
|
471
|
-
[box field sizes](/customize/theming/forms#box-field-sizes) sizes so they align
|
472
|
-
nicely when placed in row.
|
473
|
-
|
474
|
-
### Example Theme
|
475
|
-
|
476
|
-
<Playground>
|
477
|
-
<style type="text/css">
|
478
|
-
{`
|
479
|
-
.example--themed-buttons {
|
480
|
-
--rui-Button__font-weight: bold;
|
481
|
-
--rui-Button__letter-spacing: 0.05em;
|
482
|
-
--rui-Button__text-transform: uppercase;
|
483
|
-
--rui-Button__border-radius: 0;
|
484
|
-
--rui-Button--filled--primary--default__box-shadow:
|
485
|
-
0.1em 0.1em 0.5em rgba(0, 0, 0, 0.3);
|
486
|
-
--rui-Button--medium__height: 3rem;
|
487
|
-
--rui-Button--medium__padding-x: 1.25rem;
|
488
|
-
--rui-Button--medium__padding-y: 0.25rem;
|
489
|
-
}
|
490
|
-
`}
|
491
|
-
</style>
|
492
|
-
<Button label="Default filled button" />
|
493
|
-
<Button label="Default outline button" priority="outline" />
|
494
|
-
<div className="example example--themed-buttons">
|
495
|
-
<Button label="Themed filled button" />
|
496
|
-
<Button label="Themed outline button" priority="outline" />
|
497
|
-
</div>
|
498
|
-
</Playground>
|
499
|
-
|
500
|
-
### Theming Disabled State
|
501
|
-
|
502
|
-
The `disabled` state offers a bit more of design flexibility compared to other
|
503
|
-
interaction states. Firstly, there are a few common options for this state:
|
504
|
-
|
505
|
-
| Custom Property | Description |
|
506
|
-
|-----------------------------------|---------------------------------------------|
|
507
|
-
| `--rui-Button--disabled__opacity` | Opacity of disabled buttons |
|
508
|
-
| `--rui-Button--disabled__cursor` | Cursor to show on hovering disabled buttons |
|
509
|
-
|
510
|
-
Secondly, it can be further adjusted using priority and color variant specific
|
511
|
-
options for the disabled state:
|
512
|
-
|
513
|
-
`--rui-Button--<PRIORITY>--<COLOR>--disabled__<PROPERTY>`
|
514
|
-
|
515
|
-
Undefined theming options are inherited from the `default` interaction state.
|
516
|
-
|
517
|
-
Example:
|
518
|
-
|
519
|
-
<Playground>
|
520
|
-
<style type="text/css">
|
521
|
-
{`
|
522
|
-
.example--themed-disabled-buttons {
|
523
|
-
--rui-Button__border-radius: 0;
|
524
|
-
--rui-Button--disabled__opacity: 0.4;
|
525
|
-
--rui-Button--disabled__cursor: default;
|
526
|
-
--rui-Button--filled--primary--disabled__color: slate;
|
527
|
-
--rui-Button--filled--primary--disabled__border-color: silver;
|
528
|
-
--rui-Button--filled--primary--disabled__background: silver;
|
529
|
-
--rui-Button--filled--success--disabled__color: slate;
|
530
|
-
--rui-Button--filled--success--disabled__border-color: silver;
|
531
|
-
--rui-Button--filled--success--disabled__background: silver;
|
532
|
-
--rui-Button--outline--primary--disabled__color: slate;
|
533
|
-
--rui-Button--outline--primary--disabled__border-color: silver;
|
534
|
-
}
|
535
|
-
`}
|
536
|
-
</style>
|
537
|
-
<Button
|
538
|
-
label="Default filled primary button, disabled"
|
539
|
-
disabled
|
540
|
-
/>
|
541
|
-
<Button
|
542
|
-
label="Default filled success button, disabled"
|
543
|
-
color="success"
|
544
|
-
disabled
|
545
|
-
/>
|
546
|
-
<Button
|
547
|
-
label="Default outline primary button, disabled"
|
548
|
-
priority="outline"
|
549
|
-
disabled
|
550
|
-
/>
|
551
|
-
<div className="example example--themed-disabled-buttons">
|
552
|
-
<Button
|
553
|
-
label="Themed filled primary button, disabled"
|
554
|
-
disabled
|
555
|
-
/>
|
556
|
-
<Button
|
557
|
-
label="Themed filled success button, disabled"
|
558
|
-
color="success"
|
559
|
-
disabled
|
560
|
-
/>
|
561
|
-
<Button
|
562
|
-
label="Themed outline primary button, disabled"
|
563
|
-
priority="outline"
|
564
|
-
disabled
|
565
|
-
/>
|
566
|
-
</div>
|
567
|
-
</Playground>
|
568
|
-
|
569
|
-
### Theming Feedback State
|
570
|
-
|
571
|
-
Similarly to disabled state, opacity and cursor can be set for buttons in
|
572
|
-
feedback state.
|
573
|
-
|
574
|
-
| Custom Property | Description |
|
575
|
-
|-----------------------------------|------------------------------------------------------|
|
576
|
-
| `--rui-Button--feedback__opacity` | Opacity of buttons in feedback state |
|
577
|
-
| `--rui-Button--feedback__cursor` | Cursor to show on hovering buttons in feedback state |
|
578
|
-
|
579
|
-
[React synthetic events]: https://reactjs.org/docs/events.html
|
580
|
-
[button]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
|
581
|
-
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|