@react-ui-org/react-ui 0.52.0 → 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 +42 -0
- package/dist/react-ui.js +1 -0
- 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 +1 -6
- 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 +1 -6
- 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/_box-field-layout.scss +26 -14
- 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-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,23 +1,7 @@
|
|
1
|
-
---
|
2
|
-
name: ButtonGroup
|
3
|
-
menu: 'Layouts'
|
4
|
-
route: /components/button-group
|
5
|
-
---
|
6
|
-
|
7
1
|
# ButtonGroup
|
8
2
|
|
9
3
|
ButtonGroup visually groups related buttons together.
|
10
4
|
|
11
|
-
import {
|
12
|
-
Playground,
|
13
|
-
Props,
|
14
|
-
} from 'docz'
|
15
|
-
import Icon from '../../../docs/_components/Icon'
|
16
|
-
import {
|
17
|
-
Button,
|
18
|
-
ButtonGroup,
|
19
|
-
} from '../..'
|
20
|
-
|
21
5
|
## Basic Usage
|
22
6
|
|
23
7
|
To implement the ButtonGroup component, you need to import it first:
|
@@ -28,13 +12,13 @@ import { ButtonGroup } from '@react-ui-org/react-ui';
|
|
28
12
|
|
29
13
|
And use it:
|
30
14
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
15
|
+
```docoff-react-preview
|
16
|
+
<ButtonGroup>
|
17
|
+
<Button label="Week" />
|
18
|
+
<Button label="Month" />
|
19
|
+
<Button label="Year" />
|
20
|
+
</ButtonGroup>
|
21
|
+
```
|
38
22
|
|
39
23
|
See [API](#api) for all available options.
|
40
24
|
|
@@ -53,11 +37,11 @@ See [API](#api) for all available options.
|
|
53
37
|
- Use **short labels or icons** so the buttons can fit small screens.
|
54
38
|
|
55
39
|
- For toggling between on/off states, use rather the
|
56
|
-
[Toggle](/components/
|
40
|
+
[Toggle](/components/Toggle) component.
|
57
41
|
|
58
42
|
- For switching between options in a form that needs to be submitted, use rather
|
59
|
-
the [SelectField](/components/
|
60
|
-
[Radio](/components/
|
43
|
+
the [SelectField](/components/SelectField) or
|
44
|
+
[Radio](/components/Radio) components.
|
61
45
|
|
62
46
|
- In the background, ButtonGroup uses the [`fieldset`][fieldset] element. Not
|
63
47
|
only it improves the [accessibility] of the group, it also allows you to make
|
@@ -85,7 +69,7 @@ buttons of totally different types or sizes.
|
|
85
69
|
## Priorities
|
86
70
|
|
87
71
|
There are three **visual priorities** of buttons which exactly copy the
|
88
|
-
priorities of the [Button](/components/
|
72
|
+
priorities of the [Button](/components/Button/) component:
|
89
73
|
|
90
74
|
1. filled
|
91
75
|
2. outline
|
@@ -99,72 +83,72 @@ priorities of the [Button](/components/button) component:
|
|
99
83
|
The default, high-emphasis priority should be used for primary actions of your
|
100
84
|
app.
|
101
85
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
86
|
+
```docoff-react-preview
|
87
|
+
<ButtonGroup>
|
88
|
+
<Button color="secondary" label="Week" />
|
89
|
+
<Button color="secondary" label="Month" />
|
90
|
+
<Button color="secondary" label="Year" />
|
91
|
+
</ButtonGroup>
|
92
|
+
```
|
109
93
|
|
110
94
|
### Outline
|
111
95
|
|
112
96
|
Medium-emphasis buttons to contain actions that are important but not primary
|
113
97
|
in your app.
|
114
98
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
99
|
+
```docoff-react-preview
|
100
|
+
<ButtonGroup priority="outline">
|
101
|
+
<Button color="secondary" label="Week" />
|
102
|
+
<Button color="secondary" label="Month" />
|
103
|
+
<Button color="secondary" label="Year" />
|
104
|
+
</ButtonGroup>
|
105
|
+
```
|
122
106
|
|
123
107
|
### Flat
|
124
108
|
|
125
109
|
Flat buttons are designed for less pronounced actions to help maintain focus on
|
126
110
|
the content.
|
127
111
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
112
|
+
```docoff-react-preview
|
113
|
+
<ButtonGroup priority="flat">
|
114
|
+
<Button color="secondary" label="Week" />
|
115
|
+
<Button color="secondary" label="Month" />
|
116
|
+
<Button color="secondary" label="Year" />
|
117
|
+
</ButtonGroup>
|
118
|
+
```
|
135
119
|
|
136
120
|
## Sizes
|
137
121
|
|
138
122
|
All existing button sizes are also available on the button group level: small,
|
139
123
|
medium, and large.
|
140
124
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
125
|
+
```docoff-react-preview
|
126
|
+
<ButtonGroup size="small">
|
127
|
+
<Button color="secondary" label="Week" />
|
128
|
+
<Button color="secondary" label="Month" />
|
129
|
+
<Button color="secondary" label="Year" />
|
130
|
+
</ButtonGroup>
|
131
|
+
<ButtonGroup>
|
132
|
+
<Button color="secondary" label="Week" />
|
133
|
+
<Button color="secondary" label="Month" />
|
134
|
+
<Button color="secondary" label="Year" />
|
135
|
+
</ButtonGroup>
|
136
|
+
<ButtonGroup size="large">
|
137
|
+
<Button color="secondary" label="Week" />
|
138
|
+
<Button color="secondary" label="Month" />
|
139
|
+
<Button color="secondary" label="Year" />
|
140
|
+
</ButtonGroup>
|
141
|
+
```
|
158
142
|
|
159
143
|
Block button groups span the full width of a parent:
|
160
144
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
145
|
+
```docoff-react-preview
|
146
|
+
<ButtonGroup block>
|
147
|
+
<Button color="secondary" label="Week" />
|
148
|
+
<Button color="secondary" label="Month" />
|
149
|
+
<Button color="secondary" label="Year" />
|
150
|
+
</ButtonGroup>
|
151
|
+
```
|
168
152
|
|
169
153
|
## States
|
170
154
|
|
@@ -172,85 +156,95 @@ Block button groups span the full width of a parent:
|
|
172
156
|
|
173
157
|
Disables all buttons inside the group.
|
174
158
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
159
|
+
```docoff-react-preview
|
160
|
+
<ButtonGroup disabled>
|
161
|
+
<Button color="secondary" label="Week" />
|
162
|
+
<Button color="secondary" label="Month" />
|
163
|
+
<Button color="secondary" label="Year" />
|
164
|
+
</ButtonGroup>
|
165
|
+
<ButtonGroup priority="outline" disabled>
|
166
|
+
<Button color="secondary" label="Week" />
|
167
|
+
<Button color="secondary" label="Month" />
|
168
|
+
<Button color="secondary" label="Year" />
|
169
|
+
</ButtonGroup>
|
170
|
+
<ButtonGroup priority="flat" disabled>
|
171
|
+
<Button color="secondary" label="Week" />
|
172
|
+
<Button color="secondary" label="Month" />
|
173
|
+
<Button color="secondary" label="Year" />
|
174
|
+
</ButtonGroup>
|
175
|
+
```
|
192
176
|
|
193
177
|
### Feedback State
|
194
178
|
|
195
179
|
When user's action triggers an asynchronous process on background, feedback
|
196
180
|
state of individual buttons can be indicated by showing an icon.
|
197
181
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
<
|
210
|
-
|
211
|
-
|
212
|
-
<
|
213
|
-
|
214
|
-
|
182
|
+
```docoff-react-preview
|
183
|
+
<ButtonGroup>
|
184
|
+
<Button
|
185
|
+
color="success"
|
186
|
+
label="Week"
|
187
|
+
feedbackIcon={<rui-icon icon="success" />}
|
188
|
+
/>
|
189
|
+
<Button color="secondary"label="Month" />
|
190
|
+
<Button color="secondary"label="Year" />
|
191
|
+
</ButtonGroup>
|
192
|
+
<ButtonGroup priority="outline">
|
193
|
+
<Button
|
194
|
+
color="success"
|
195
|
+
label="Week"
|
196
|
+
feedbackIcon={<rui-icon icon="success" />}
|
197
|
+
/>
|
198
|
+
<Button color="secondary"label="Month" />
|
199
|
+
<Button color="secondary"label="Year" />
|
200
|
+
</ButtonGroup>
|
201
|
+
<ButtonGroup priority="flat">
|
202
|
+
<Button
|
203
|
+
color="success"
|
204
|
+
label="Week"
|
205
|
+
feedbackIcon={<rui-icon icon="success" />}
|
206
|
+
/>
|
207
|
+
<Button color="secondary"label="Month" />
|
208
|
+
<Button color="secondary"label="Year" />
|
209
|
+
</ButtonGroup>
|
210
|
+
```
|
215
211
|
|
216
212
|
### Selected State
|
217
213
|
|
218
214
|
To highlight the selected option, just apply the selected color variant for
|
219
215
|
the desired item.
|
220
216
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
217
|
+
```docoff-react-preview
|
218
|
+
<ButtonGroup>
|
219
|
+
<Button color="selected" label="Week" />
|
220
|
+
<Button color="secondary" label="Month" />
|
221
|
+
<Button color="secondary" label="Year" />
|
222
|
+
</ButtonGroup>
|
223
|
+
<ButtonGroup priority="outline">
|
224
|
+
<Button color="selected" label="Week" />
|
225
|
+
<Button color="secondary" label="Month" />
|
226
|
+
<Button color="secondary" label="Year" />
|
227
|
+
</ButtonGroup>
|
228
|
+
<ButtonGroup priority="flat">
|
229
|
+
<Button color="selected" label="Week" />
|
230
|
+
<Button color="secondary" label="Month" />
|
231
|
+
<Button color="secondary" label="Year" />
|
232
|
+
</ButtonGroup>
|
233
|
+
```
|
238
234
|
|
239
235
|
## Accessibility
|
240
236
|
|
241
237
|
You can improve the accessibility of your ButtonGroup by linking it to a label
|
242
238
|
and communicating the state of individual options.
|
243
239
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
</>
|
253
|
-
</Playground>
|
240
|
+
```docoff-react-preview
|
241
|
+
<span id="period-label">Period:</span>
|
242
|
+
<ButtonGroup aria-labelledby="period-label">
|
243
|
+
<Button color="selected" label="Week" aria-pressed />
|
244
|
+
<Button color="secondary" label="Month" aria-pressed={false} />
|
245
|
+
<Button color="secondary" label="Year" aria-pressed={false} />
|
246
|
+
</ButtonGroup>
|
247
|
+
```
|
254
248
|
|
255
249
|
## Forwarding HTML Attributes
|
256
250
|
|
@@ -265,7 +259,7 @@ its accessibility.
|
|
265
259
|
|
266
260
|
## API
|
267
261
|
|
268
|
-
<
|
262
|
+
<docoff-react-props src="/components/ButtonGroup/ButtonGroup.jsx"></docoff-react-props>
|
269
263
|
|
270
264
|
## Theming
|
271
265
|
|
@@ -44,7 +44,7 @@ Card.propTypes = {
|
|
44
44
|
*/
|
45
45
|
children: PropTypes.node.isRequired,
|
46
46
|
/**
|
47
|
-
* [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the card.
|
47
|
+
* [Color variant](/docs/foundation/colors#component-colors) to clarify importance and meaning of the card.
|
48
48
|
*/
|
49
49
|
color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
|
50
50
|
/**
|
@@ -0,0 +1,314 @@
|
|
1
|
+
# Card
|
2
|
+
|
3
|
+
Cards contain content and actions about a single subject.
|
4
|
+
|
5
|
+
## Basic Usage
|
6
|
+
|
7
|
+
To implement the Card component, you need to import at least Card and
|
8
|
+
[CardBody](#cardbody) components:
|
9
|
+
|
10
|
+
```js
|
11
|
+
import { Card, CardBody } from '@react-ui-org/react-ui';
|
12
|
+
```
|
13
|
+
|
14
|
+
And use it:
|
15
|
+
|
16
|
+
```docoff-react-preview
|
17
|
+
<Card>
|
18
|
+
<CardBody>
|
19
|
+
Hello!
|
20
|
+
</CardBody>
|
21
|
+
</Card>
|
22
|
+
```
|
23
|
+
|
24
|
+
See [API](#api) for all available options.
|
25
|
+
|
26
|
+
## General Guidelines
|
27
|
+
|
28
|
+
- Default card is **designed for non-white background.** You may want to either
|
29
|
+
use the [raised variant](#raised-card) or
|
30
|
+
[customize](/docs/customize/theming/overview) the default appearance to make the
|
31
|
+
card stand out on white surfaces.
|
32
|
+
|
33
|
+
- Use optional [CardBody](#cardbody) and [CardFooter](#cardfooter) components to
|
34
|
+
provide your content with expected spacing.
|
35
|
+
|
36
|
+
- Use **medium or low-emphasis buttons** when there are more cards, e.g. in a
|
37
|
+
grid. It will help you keep the UI clean and easy to scan.
|
38
|
+
|
39
|
+
- **Card, or Paper?** Card is a versatile surface for displaying content.
|
40
|
+
However, there is also the [Paper](/components/Paper) component. While Card
|
41
|
+
is designed for displaying items (and also supports more visual options),
|
42
|
+
Paper is usually used to hold larger content areas like lists, grids, or
|
43
|
+
forms.
|
44
|
+
|
45
|
+
## Composition
|
46
|
+
|
47
|
+
Card is decomposed into the following components:
|
48
|
+
|
49
|
+
- [Card](#api)
|
50
|
+
- [CardBody](#cardbody)
|
51
|
+
- [CardFooter](#cardfooter)
|
52
|
+
|
53
|
+
Aside from the [CardBody](#cardbody) element, you can add a
|
54
|
+
[CardFooter](#cardfooter) to better separate your card's actions from the rest
|
55
|
+
of the content.
|
56
|
+
|
57
|
+
Import all necessary components:
|
58
|
+
|
59
|
+
```js
|
60
|
+
import { Card, CardBody, CardFooter } from '@react-ui-org/react-ui';
|
61
|
+
```
|
62
|
+
|
63
|
+
And use them:
|
64
|
+
|
65
|
+
```docoff-react-preview
|
66
|
+
<Card>
|
67
|
+
<CardBody>
|
68
|
+
Hello! I'm card with footer.
|
69
|
+
</CardBody>
|
70
|
+
<CardFooter>
|
71
|
+
<Button label="Read more" priority="outline" />
|
72
|
+
</CardFooter>
|
73
|
+
</Card>
|
74
|
+
```
|
75
|
+
|
76
|
+
👉 CardFooter is required in case you need to align the actions of multiple
|
77
|
+
cards with varying height of content.
|
78
|
+
|
79
|
+
## Raised Card
|
80
|
+
|
81
|
+
Add optional shadow to lift the card above surface.
|
82
|
+
|
83
|
+
```docoff-react-preview
|
84
|
+
<Card raised>
|
85
|
+
<CardBody>
|
86
|
+
Hello! I'm raised card with footer.
|
87
|
+
</CardBody>
|
88
|
+
<CardFooter>
|
89
|
+
<Button label="Read more" priority="outline" />
|
90
|
+
</CardFooter>
|
91
|
+
</Card>
|
92
|
+
```
|
93
|
+
|
94
|
+
## Dense Card
|
95
|
+
|
96
|
+
Use a dense card when you need to save space on screen. Other elements in the
|
97
|
+
card should be also smaller to keep the card contained and easy to scan.
|
98
|
+
|
99
|
+
```docoff-react-preview
|
100
|
+
<Card dense raised>
|
101
|
+
<CardBody>
|
102
|
+
<small>Hello! I'm dense card. Everything is smaller here.</small>
|
103
|
+
</CardBody>
|
104
|
+
<CardFooter>
|
105
|
+
<Button label="Read more" priority="outline" size="small" />
|
106
|
+
</CardFooter>
|
107
|
+
</Card>
|
108
|
+
```
|
109
|
+
|
110
|
+
## Scrollable Card
|
111
|
+
|
112
|
+
Combine Card with [ScrollView](/components/ScrollView) to enable scrolling
|
113
|
+
for card content.
|
114
|
+
|
115
|
+
```docoff-react-preview
|
116
|
+
<div
|
117
|
+
style={{
|
118
|
+
display: 'flex',
|
119
|
+
height: '200px',
|
120
|
+
}}
|
121
|
+
>
|
122
|
+
<Card raised>
|
123
|
+
<ScrollView>
|
124
|
+
<CardBody>
|
125
|
+
Hello! I'm scrollable card.
|
126
|
+
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
|
127
|
+
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis
|
128
|
+
dis parturient montes, nascetur ridiculus mus. Donec quam felis,
|
129
|
+
ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa
|
130
|
+
quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget,
|
131
|
+
arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
|
132
|
+
Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras
|
133
|
+
dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend
|
134
|
+
tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac,
|
135
|
+
enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.
|
136
|
+
Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean
|
137
|
+
imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper
|
138
|
+
ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus
|
139
|
+
eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing
|
140
|
+
sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar,
|
141
|
+
hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus.
|
142
|
+
</CardBody>
|
143
|
+
</ScrollView>
|
144
|
+
</Card>
|
145
|
+
</div>
|
146
|
+
```
|
147
|
+
|
148
|
+
## Color Variants
|
149
|
+
|
150
|
+
Card supports all
|
151
|
+
[component colors](/docs/foundation/colors#component-colors) to cover different needs
|
152
|
+
of your app.
|
153
|
+
|
154
|
+
```docoff-react-preview
|
155
|
+
<Card color="success">
|
156
|
+
<CardBody>
|
157
|
+
Hello! I'm success variant of card.
|
158
|
+
</CardBody>
|
159
|
+
<CardFooter>
|
160
|
+
<Button label="Read more" priority="outline" color="success" />
|
161
|
+
</CardFooter>
|
162
|
+
</Card>
|
163
|
+
<Card color="warning">
|
164
|
+
<CardBody>
|
165
|
+
Hello! I'm warning variant of card.
|
166
|
+
</CardBody>
|
167
|
+
<CardFooter>
|
168
|
+
<Button label="Read more" priority="outline" color="warning" />
|
169
|
+
</CardFooter>
|
170
|
+
</Card>
|
171
|
+
<Card color="danger">
|
172
|
+
<CardBody>
|
173
|
+
Hello! I'm danger variant of card.
|
174
|
+
</CardBody>
|
175
|
+
<CardFooter>
|
176
|
+
<Button label="Read more" priority="outline" color="danger" />
|
177
|
+
</CardFooter>
|
178
|
+
</Card>
|
179
|
+
<Card color="help">
|
180
|
+
<CardBody>
|
181
|
+
Hello! I'm help variant of card.
|
182
|
+
</CardBody>
|
183
|
+
<CardFooter>
|
184
|
+
<Button label="Read more" priority="outline" color="help" />
|
185
|
+
</CardFooter>
|
186
|
+
</Card>
|
187
|
+
<Card color="info">
|
188
|
+
<CardBody>
|
189
|
+
Hello! I'm info variant of card.
|
190
|
+
</CardBody>
|
191
|
+
<CardFooter>
|
192
|
+
<Button label="Read more" priority="outline" color="info" />
|
193
|
+
</CardFooter>
|
194
|
+
</Card>
|
195
|
+
<Card color="note">
|
196
|
+
<CardBody>
|
197
|
+
Hello! I'm note variant of card.
|
198
|
+
</CardBody>
|
199
|
+
<CardFooter>
|
200
|
+
<Button label="Read more" priority="outline" color="note" />
|
201
|
+
</CardFooter>
|
202
|
+
</Card>
|
203
|
+
<Card>
|
204
|
+
<CardBody>
|
205
|
+
Hello! I'm light (default) variant of card.
|
206
|
+
</CardBody>
|
207
|
+
<CardFooter>
|
208
|
+
<Button label="Read more" priority="outline" color="dark" />
|
209
|
+
</CardFooter>
|
210
|
+
</Card>
|
211
|
+
<Card color="dark">
|
212
|
+
<CardBody>
|
213
|
+
Hello! I'm dark variant of card.
|
214
|
+
</CardBody>
|
215
|
+
<CardFooter>
|
216
|
+
<Button label="Read more" priority="outline" color="light" />
|
217
|
+
</CardFooter>
|
218
|
+
</Card>
|
219
|
+
```
|
220
|
+
|
221
|
+
## States
|
222
|
+
|
223
|
+
### Disabled State
|
224
|
+
|
225
|
+
Entire card can appear disabled. However, you'll still need to manually disable
|
226
|
+
its interactive elements to disallow user's interaction.
|
227
|
+
|
228
|
+
```docoff-react-preview
|
229
|
+
<Card disabled>
|
230
|
+
<CardBody>
|
231
|
+
Hello! I'm a disabled card.
|
232
|
+
</CardBody>
|
233
|
+
<CardFooter>
|
234
|
+
<Button label="Read more" priority="outline" disabled />
|
235
|
+
</CardFooter>
|
236
|
+
</Card>
|
237
|
+
<Card disabled raised>
|
238
|
+
<CardBody>
|
239
|
+
Hello! I'm a disabled raised card.
|
240
|
+
</CardBody>
|
241
|
+
<CardFooter>
|
242
|
+
<Button label="Read more" priority="outline" disabled />
|
243
|
+
</CardFooter>
|
244
|
+
</Card>
|
245
|
+
<Card color="success" disabled>
|
246
|
+
<CardBody>
|
247
|
+
Hello! I'm a disabled success variant of card.
|
248
|
+
</CardBody>
|
249
|
+
<CardFooter>
|
250
|
+
<Button label="Read more" priority="outline" color="success" disabled />
|
251
|
+
</CardFooter>
|
252
|
+
</Card>
|
253
|
+
```
|
254
|
+
|
255
|
+
## Forwarding HTML Attributes
|
256
|
+
|
257
|
+
In addition to the options below in the [component's API](#api) section, you
|
258
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
259
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
260
|
+
HTML element. This enables making the component interactive and helps to improve
|
261
|
+
its accessibility.
|
262
|
+
|
263
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
264
|
+
[div] element.
|
265
|
+
|
266
|
+
## API
|
267
|
+
|
268
|
+
<docoff-react-props src="/components/Card/Card.jsx"></docoff-react-props>
|
269
|
+
|
270
|
+
### CardBody
|
271
|
+
|
272
|
+
Space your content with CardBody. See [Composition](#composition) for
|
273
|
+
all details.
|
274
|
+
|
275
|
+
<docoff-react-props src="/components/Card/CardBody.jsx"></docoff-react-props>
|
276
|
+
|
277
|
+
### CardFooter
|
278
|
+
|
279
|
+
Separate your card actions with CardFooter. See
|
280
|
+
[Composition](#composition) for all details.
|
281
|
+
|
282
|
+
<docoff-react-props src="/components/Card/CardFooter.jsx"></docoff-react-props>
|
283
|
+
|
284
|
+
## Theming
|
285
|
+
|
286
|
+
### Common Theming Options
|
287
|
+
|
288
|
+
| Custom Property | Description |
|
289
|
+
|------------------------------------------------------|--------------------------------------------------------------|
|
290
|
+
| `--rui-Card__padding` | Padding shared by card header, body and footer |
|
291
|
+
| `--rui-Card__border-width` | Border width |
|
292
|
+
| `--rui-Card__border-radius` | Corner radius |
|
293
|
+
| `--rui-Card--dense__padding` | Padding of dense card |
|
294
|
+
| `--rui-Card--raised__box-shadow` | Box shadow of raised card |
|
295
|
+
| `--rui-Card--disabled__background-color` | Card background color in disabled state |
|
296
|
+
| `--rui-Card--disabled__opacity` | Card opacity in disabled state |
|
297
|
+
|
298
|
+
### Theming Variants
|
299
|
+
|
300
|
+
It's possible to adjust the theme of specific color variant. Naming convention
|
301
|
+
looks as follows:
|
302
|
+
|
303
|
+
`--rui-Card--<COLOR>__<PROPERTY>`
|
304
|
+
|
305
|
+
Where:
|
306
|
+
|
307
|
+
- `<COLOR>` is one of supported
|
308
|
+
[component colors](/docs/foundation/colors#component-colors)
|
309
|
+
(see [color variants](#color-variants) and [API](#api)),
|
310
|
+
- `<PROPERTY>` is one of `color` (color of text), `border-color`, or
|
311
|
+
`background-color`.
|
312
|
+
|
313
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
314
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|