flet-box 1.1.2 → 1.1.3
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/AGENTS_FOR_CODE_GEN.md +284 -0
- package/CONTRIBUTING.md +238 -0
- package/README.md +2 -2
- package/bin/cli.js +88 -1
- package/bin/commands/auditFix.js +181 -27
- package/bin/commands/checkApi.js +14 -3
- package/bin/commands/checkStructure.js +368 -0
- package/bin/commands/checkSyntax.js +293 -0
- package/bin/commands/checkUi.js +666 -14
- package/bin/commands/create.js +14 -0
- package/bin/commands/createBundle.js +2 -2
- package/bin/commands/metrics.js +448 -0
- package/bin/commands/release.js +18 -0
- package/bin/commands/report.js +849 -0
- package/bin/commands/tools.js +76 -0
- package/bin/commands/unpack.js +39 -11
- package/bin/commands/verify.js +879 -0
- package/bin/mcp.js +280 -0
- package/bin/utils/contract.js +27 -0
- package/bin/utils/dtsProps.js +5 -1
- package/bin/utils/migrationGuide.js +146 -0
- package/bin/utils/moduleExports.js +9 -5
- package/bin/utils/templates.js +225 -18
- package/bin/utils/toolkit.js +191 -0
- package/docs/README.md +5 -1
- package/docs/arquitectura.md +1 -1
- package/docs/cli/README.md +168 -2
- package/docs/guides/README.md +6 -0
- package/docs/guides/accessibility.md +2 -1
- package/docs/guides/ai-toolkit.md +166 -0
- package/docs/guides/compatibility.md +1 -1
- package/docs/guides/migration.md +92 -0
- package/docs/guides/minification-and-protection.md +2 -1
- package/docs/guides/mobile-and-platforms.md +1 -1
- package/docs/guides/online-updates.md +2 -0
- package/docs/server/deployment.md +1 -1
- package/docs/tools/styling.md +2 -2
- package/docs/tools/theme.md +139 -4
- package/docs/widget/Accordion.md +74 -8
- package/docs/widget/AdMob.md +68 -3
- package/docs/widget/AdSense.md +67 -2
- package/docs/widget/AlertDialog.md +1 -1
- package/docs/widget/AnimatedBox.md +80 -39
- package/docs/widget/AnimatedText.md +74 -18
- package/docs/widget/Audio.md +73 -14
- package/docs/widget/Avatar.md +69 -4
- package/docs/widget/Badge.md +68 -3
- package/docs/widget/BottomSheet.md +2 -2
- package/docs/widget/Button.md +69 -3
- package/docs/widget/Card.md +69 -4
- package/docs/widget/Carousel.md +67 -2
- package/docs/widget/Chart.md +67 -2
- package/docs/widget/Checkbox.md +74 -8
- package/docs/widget/Chip.md +68 -3
- package/docs/widget/CircularBar.md +74 -15
- package/docs/widget/CircularChart.md +71 -10
- package/docs/widget/CodeViewer.md +67 -2
- package/docs/widget/Column.md +68 -3
- package/docs/widget/Container.md +68 -3
- package/docs/widget/DataTable.md +67 -2
- package/docs/widget/Divider.md +67 -2
- package/docs/widget/DraggBox.md +67 -2
- package/docs/widget/Dropdown.md +76 -10
- package/docs/widget/DroppBox.md +67 -2
- package/docs/widget/FloatingActionButton.md +68 -3
- package/docs/widget/GridView.md +67 -2
- package/docs/widget/Icon.md +71 -5
- package/docs/widget/Image.md +68 -3
- package/docs/widget/Input.md +68 -3
- package/docs/widget/Inspector.md +2 -2
- package/docs/widget/InstallButton.md +73 -13
- package/docs/widget/ListTile.md +69 -3
- package/docs/widget/ListView.md +67 -2
- package/docs/widget/Maps.md +68 -3
- package/docs/widget/Markdown.md +74 -15
- package/docs/widget/MatrixRain.md +72 -11
- package/docs/widget/Menu.md +209 -0
- package/docs/widget/Modal.md +3 -3
- package/docs/widget/Pagination.md +68 -3
- package/docs/widget/ParallaxBox.md +72 -12
- package/docs/widget/ProgressBar.md +69 -4
- package/docs/widget/QRCode.md +67 -2
- package/docs/widget/README.md +54 -50
- package/docs/widget/Radio.md +76 -10
- package/docs/widget/Rating.md +70 -6
- package/docs/widget/Row.md +68 -3
- package/docs/widget/Skeleton.md +68 -3
- package/docs/widget/Slider.md +75 -9
- package/docs/widget/SnackBar.md +2 -2
- package/docs/widget/Stack.md +68 -3
- package/docs/widget/Stepper.md +68 -3
- package/docs/widget/Switch.md +74 -8
- package/docs/widget/Text.md +71 -4
- package/docs/widget/ThemePicker.md +197 -0
- package/docs/widget/Tooltip.md +72 -7
- package/docs/widget/TreeView.md +70 -10
- package/docs/widget/Video.md +71 -10
- package/package.json +10 -3
- package/skills/fletbox-design/SKILL.md +89 -5
- package/skills/fletbox-motion/SKILL.md +1 -1
- package/skills/fletbox-rules/SKILL.md +56 -4
- package/src/core/runApp.js +12 -0
- package/src/index.d.ts +374 -101
- package/src/index.js +9 -0
- package/src/navigations/AdaptiveScaffold.js +2 -2
- package/src/navigations/BottomNavigation.js +1 -1
- package/src/navigations/Scaffold.js +18 -6
- package/src/tools/useState.js +11 -4
- package/src/utils/colors.js +275 -0
- package/src/utils/errorBoundary.js +288 -0
- package/src/utils/index.js +10 -2
- package/src/utils/stackPosition.js +39 -24
- package/src/utils/syntaxHighlight.js +4 -1
- package/src/utils/themes.js +279 -3
- package/src/widget-factory/addChildren.js +17 -10
- package/src/widget-factory/assignProps.js +18 -6
- package/src/widget-factory/createWidget.js +7 -0
- package/src/widget-factory/deprecations.js +77 -0
- package/src/widget-factory/translateProps.js +11 -1
- package/src/widget-factory/warnings.js +1 -27
- package/src/widget-factory/widgetFactory.js +59 -17
- package/src/widgets/Accordion.js +21 -7
- package/src/widgets/Badge.js +11 -2
- package/src/widgets/Button.js +15 -3
- package/src/widgets/Carousel.js +12 -4
- package/src/widgets/Chart.js +7 -2
- package/src/widgets/Checkbox.js +1 -2
- package/src/widgets/Chip.js +24 -10
- package/src/widgets/CircularBar.js +9 -3
- package/src/widgets/CircularChart.js +5 -3
- package/src/widgets/Container.js +6 -0
- package/src/widgets/Divider.js +3 -1
- package/src/widgets/DraggBox.js +9 -0
- package/src/widgets/Dropdown.js +3 -3
- package/src/widgets/DroppBox.js +5 -0
- package/src/widgets/FloatingActionButton.js +1 -1
- package/src/widgets/Icon.js +5 -1
- package/src/widgets/InstallButton.js +4 -2
- package/src/widgets/Markdown.js +171 -103
- package/src/widgets/Menu.js +340 -0
- package/src/widgets/Modal.js +7 -1
- package/src/widgets/Pagination.js +10 -5
- package/src/widgets/ProgressBar.js +5 -4
- package/src/widgets/QRCode.js +4 -0
- package/src/widgets/Radio.js +1 -2
- package/src/widgets/Rating.js +9 -0
- package/src/widgets/Slider.js +4 -1
- package/src/widgets/SnackBar.js +2 -2
- package/src/widgets/Switch.js +1 -2
- package/src/widgets/Text.js +9 -5
- package/src/widgets/ThemePicker.js +234 -0
- package/src/widgets/TreeView.js +2 -1
- package/src/widgets/index.js +2 -0
- package/docs/CONTRIBUTING.md +0 -156
package/docs/widget/Checkbox.md
CHANGED
|
@@ -23,7 +23,8 @@ const terms = Checkbox({
|
|
|
23
23
|
| Prop | Type | Description |
|
|
24
24
|
| --- | --- | --- |
|
|
25
25
|
| `checked` | `boolean` | Current checked state. |
|
|
26
|
-
| `onCheck` | `(checked: boolean) => void` |
|
|
26
|
+
| `onCheck` | `(checked: boolean) => void` | Deprecated alias of `onPress`. |
|
|
27
|
+
| `onPress` | `(checked: boolean) => void` | Called with the new checked state (`true` or `false`). |
|
|
27
28
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
28
29
|
| `size` | `number` | Overall size preset or pixel value, depending on the widget. |
|
|
29
30
|
| `activeColor` | `Color` | Color used in the active state. |
|
|
@@ -36,11 +37,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
36
37
|
|
|
37
38
|
| Prop | Type | Description |
|
|
38
39
|
| --- | --- | --- |
|
|
40
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
41
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
42
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
43
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
44
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
45
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
46
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
47
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
48
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
49
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
50
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
51
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
52
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
53
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
54
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
55
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
56
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
39
57
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
40
58
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
41
59
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
60
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
61
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
62
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
63
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
64
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
65
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
66
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
67
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
68
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
69
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
70
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
71
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
72
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
73
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
74
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
75
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
76
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
77
|
+
| `fontSize` | `number` | Size of the font. |
|
|
78
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
79
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
42
80
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
81
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
82
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
83
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
84
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
85
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
86
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
87
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
88
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
43
89
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
90
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
91
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
92
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
93
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
94
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
95
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
96
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
97
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
44
98
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
45
99
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
46
100
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -50,11 +104,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
50
104
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
51
105
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
52
106
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
107
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
108
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
109
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
110
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
53
111
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
54
112
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
55
113
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
56
|
-
| `onPress` | `(
|
|
57
|
-
| `onClick` | `(
|
|
114
|
+
| `onPress` | `(event?: Event) => void` | Called with the new checked state (`true` or `false`). |
|
|
115
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
116
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
117
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
118
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
119
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
120
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
121
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
122
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
123
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
58
124
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
59
125
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
60
126
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -71,7 +137,7 @@ const remember = Checkbox({
|
|
|
71
137
|
checked: true,
|
|
72
138
|
label: "Remember me",
|
|
73
139
|
activeColor: "#2563eb",
|
|
74
|
-
|
|
140
|
+
onPress: (checked) => console.log("remember:", checked),
|
|
75
141
|
});
|
|
76
142
|
```
|
|
77
143
|
|
|
@@ -87,7 +153,7 @@ const updates = Checkbox({
|
|
|
87
153
|
activeColor: "#7c3aed",
|
|
88
154
|
variant: "filled",
|
|
89
155
|
disabled: false,
|
|
90
|
-
|
|
156
|
+
onPress: (checked) => {
|
|
91
157
|
console.log("updates:", checked);
|
|
92
158
|
},
|
|
93
159
|
});
|
|
@@ -96,7 +162,7 @@ const updates = Checkbox({
|
|
|
96
162
|
## Tips
|
|
97
163
|
|
|
98
164
|
- Use Checkbox inside forms where several options may be true together; use Switch for one immediate on/off setting.
|
|
99
|
-
-
|
|
165
|
+
- onPress fires with the new boolean, so write it straight into your state.
|
|
100
166
|
- A filled checkbox needs no second color: `activeColor` is the plate and the tick reads itself on it.
|
|
101
167
|
|
|
102
168
|
## Accessibility
|
|
@@ -105,7 +171,7 @@ const updates = Checkbox({
|
|
|
105
171
|
|
|
106
172
|
## Behavior
|
|
107
173
|
|
|
108
|
-
- Uncontrolled when checked is omitted; the widget tracks its own state and reports changes through
|
|
174
|
+
- Uncontrolled when checked is omitted; the widget tracks its own state and reports changes through onPress.
|
|
109
175
|
- The returned element exposes setChecked(value) and getChecked() for programmatic control.
|
|
110
176
|
- `size` is the edge of the drawn box; the press target around it stays 40 units and does not shrink with it.
|
|
111
177
|
- The box carries a step of the radius scale (4 by default, 8 from `size: 28`), and a `borderRadius` rounds the box rather than the invisible target around it.
|
|
@@ -125,4 +191,4 @@ const updates = Checkbox({
|
|
|
125
191
|
- **Next:** [Radio](Radio.md)
|
|
126
192
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
127
193
|
|
|
128
|
-
You are reading **Chapter 2 · Interaction basics** (3 of
|
|
194
|
+
You are reading **Chapter 2 · Interaction basics** (3 of 9).
|
package/docs/widget/Chip.md
CHANGED
|
@@ -30,7 +30,7 @@ const tag = Chip({
|
|
|
30
30
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
31
31
|
| `textColor` | `Color` | Color of the button label. |
|
|
32
32
|
| `borderColor` | `Color` | Color used for the border. |
|
|
33
|
-
| `size` | `
|
|
33
|
+
| `size` | `number` | Overall size preset or pixel value, depending on the widget. |
|
|
34
34
|
| `borderRadius` | `number \| string` | Rounds the corners of the widget. |
|
|
35
35
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
36
36
|
| `gap` | `number` | Space between children along the layout axis. |
|
|
@@ -41,11 +41,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
|
|
42
42
|
| Prop | Type | Description |
|
|
43
43
|
| --- | --- | --- |
|
|
44
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
45
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
46
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
47
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
48
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
49
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
50
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
51
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
52
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
53
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
54
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
55
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
57
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
58
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
59
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
60
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
44
61
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
45
62
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
46
63
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
64
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
65
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
66
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
67
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
68
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
69
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
70
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
71
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
72
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
73
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
74
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
75
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
76
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
77
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
78
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
79
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
80
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
81
|
+
| `fontSize` | `number` | Size of the font. |
|
|
82
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
83
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
47
84
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
85
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
86
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
87
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
88
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
89
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
90
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
91
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
92
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
48
93
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
94
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
95
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
96
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
97
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
98
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
99
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
100
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
101
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
49
102
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
50
103
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
51
104
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -55,11 +108,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
55
108
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
56
109
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
57
110
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
111
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
112
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
113
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
114
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
58
115
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
59
116
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
60
117
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
61
|
-
| `onPress` | `(
|
|
62
|
-
| `onClick` | `(
|
|
118
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
119
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
120
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
121
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
122
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
123
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
124
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
125
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
126
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
127
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
63
128
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
64
129
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
65
130
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -66,11 +66,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
66
66
|
|
|
67
67
|
| Prop | Type | Description |
|
|
68
68
|
| --- | --- | --- |
|
|
69
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
70
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
71
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
72
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
73
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
74
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
75
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
76
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
77
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
78
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
79
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
80
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
81
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
82
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
83
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
84
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
85
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
69
86
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
70
87
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
71
88
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
89
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
90
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
91
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
92
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
93
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
94
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
95
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
96
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
97
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
98
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
99
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
100
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
101
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
102
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
103
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
104
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
105
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
106
|
+
| `fontSize` | `number` | Size of the font. |
|
|
107
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
108
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
72
109
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
110
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
111
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
112
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
113
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
114
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
115
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
116
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
117
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
73
118
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
119
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
120
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
121
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
122
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
123
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
124
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
125
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
126
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
74
127
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
75
128
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
76
129
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -80,11 +133,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
80
133
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
81
134
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
82
135
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
136
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
137
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
138
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
139
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
83
140
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
84
141
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
85
142
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
86
|
-
| `onPress` | `(
|
|
87
|
-
| `onClick` | `(
|
|
143
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
144
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
145
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
146
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
147
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
148
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
149
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
150
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
151
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
152
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
88
153
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
89
154
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
90
155
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -136,24 +201,18 @@ const progress = CircularBar({
|
|
|
136
201
|
## Tips
|
|
137
202
|
|
|
138
203
|
- Leave size unset to fill the parent width, or set size for a fixed square canvas.
|
|
139
|
-
- valueFormat accepts "percent", "value", or "custom"; customValueFormatter
|
|
140
|
-
-
|
|
141
|
-
- When valueFormat is "value", use valuePrefix and valueSuffix to render units like
|
|
142
|
-
- "$" or "%".
|
|
204
|
+
- valueFormat accepts "percent", "value", or "custom"; customValueFormatter overrides how the number is rendered entirely.
|
|
205
|
+
- When valueFormat is "value", use valuePrefix and valueSuffix to render units like "$" or "%".
|
|
143
206
|
|
|
144
207
|
## Accessibility
|
|
145
208
|
|
|
146
|
-
- Canvas contents are invisible to assistive technology, so add a label or subtitle
|
|
147
|
-
- next to the bar to give the number context.
|
|
209
|
+
- Canvas contents are invisible to assistive technology, so add a label or subtitle next to the bar to give the number context.
|
|
148
210
|
|
|
149
211
|
## Behavior
|
|
150
212
|
|
|
151
|
-
- With animate: true the sweep animates from zero and onComplete fires once it reaches
|
|
152
|
-
- the
|
|
153
|
-
-
|
|
154
|
-
- onHover boolean.
|
|
155
|
-
- When size is unset the canvas re-measures its container via ResizeObserver and
|
|
156
|
-
- releases the observer on unmount.
|
|
213
|
+
- With animate: true the sweep animates from zero and onComplete fires once it reaches the target value.
|
|
214
|
+
- Clicking the bar passes { value, max, percent } to onClick; hovering toggles the onHover boolean.
|
|
215
|
+
- When size is unset the canvas re-measures its container via ResizeObserver and releases the observer on unmount.
|
|
157
216
|
|
|
158
217
|
## Related widgets
|
|
159
218
|
|
|
@@ -169,4 +228,4 @@ const progress = CircularBar({
|
|
|
169
228
|
- **Next:** [Skeleton](Skeleton.md)
|
|
170
229
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
171
230
|
|
|
172
|
-
You are reading **Chapter 4 · Feedback and overlays** (
|
|
231
|
+
You are reading **Chapter 4 · Feedback and overlays** (8 of 11).
|
|
@@ -61,11 +61,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
61
61
|
|
|
62
62
|
| Prop | Type | Description |
|
|
63
63
|
| --- | --- | --- |
|
|
64
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
65
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
66
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
67
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
68
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
69
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
70
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
71
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
72
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
73
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
74
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
75
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
76
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
77
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
78
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
79
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
80
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
64
81
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
65
82
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
66
83
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
84
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
85
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
86
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
87
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
88
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
89
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
90
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
91
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
92
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
93
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
94
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
95
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
96
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
97
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
98
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
99
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
100
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
101
|
+
| `fontSize` | `number` | Size of the font. |
|
|
102
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
103
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
67
104
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
105
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
106
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
107
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
108
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
109
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
110
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
111
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
112
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
68
113
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
114
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
115
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
116
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
117
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
118
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
119
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
120
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
121
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
69
122
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
70
123
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
71
124
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -75,11 +128,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
75
128
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
76
129
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
77
130
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
131
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
132
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
133
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
134
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
78
135
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
79
136
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
80
137
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
81
|
-
| `onPress` | `(
|
|
82
|
-
| `onClick` | `(
|
|
138
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
139
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
140
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
141
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
142
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
143
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
144
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
145
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
146
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
147
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
83
148
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
84
149
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
85
150
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -135,23 +200,19 @@ const chart = CircularChart({
|
|
|
135
200
|
|
|
136
201
|
## Tips
|
|
137
202
|
|
|
138
|
-
- Each slice is { value, label, color }; omit color to take colors from defaultColors
|
|
139
|
-
- in order.
|
|
203
|
+
- Each slice is { value, label, color }; omit color to take colors from defaultColors in order.
|
|
140
204
|
- Set innerRadius for a donut, or widen strokeWidth relative to size to make a ring.
|
|
141
205
|
- semiCircle: "top" renders a half gauge and adjusts the canvas aspect to match.
|
|
142
206
|
|
|
143
207
|
## Accessibility
|
|
144
208
|
|
|
145
|
-
- Canvas slices are not read by screen readers; mirror the same data in text or a
|
|
146
|
-
- table legend beside the chart.
|
|
209
|
+
- Canvas slices are not read by screen readers; mirror the same data in text or a table legend beside the chart.
|
|
147
210
|
|
|
148
211
|
## Behavior
|
|
149
212
|
|
|
150
213
|
- centerContent accepts a string or a widget rendered in the donut hole.
|
|
151
|
-
- The hole is the page showing through, not a filled disc, so a donut reads
|
|
152
|
-
- as
|
|
153
|
-
- onHover receives (slice | null, index) as the pointer moves between slices, and
|
|
154
|
-
- onComplete fires when the entry sweep finishes.
|
|
214
|
+
- The hole is the page showing through, not a filled disc, so a donut reads as a ring on any surface.
|
|
215
|
+
- onHover receives (slice | null, index) as the pointer moves between slices, and onComplete fires when the entry sweep finishes.
|
|
155
216
|
|
|
156
217
|
## Related widgets
|
|
157
218
|
|
|
@@ -41,11 +41,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
41
41
|
|
|
42
42
|
| Prop | Type | Description |
|
|
43
43
|
| --- | --- | --- |
|
|
44
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
45
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
46
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
47
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
48
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
49
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
50
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
51
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
52
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
53
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
54
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
55
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
57
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
58
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
59
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
60
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
44
61
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
45
62
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
46
63
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
64
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
65
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
66
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
67
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
68
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
69
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
70
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
71
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
72
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
73
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
74
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
75
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
76
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
77
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
78
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
79
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
80
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
81
|
+
| `fontSize` | `number` | Size of the font. |
|
|
82
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
83
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
47
84
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
85
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
86
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
87
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
88
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
89
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
90
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
91
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
92
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
48
93
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
94
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
95
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
96
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
97
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
98
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
99
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
100
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
101
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
49
102
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
50
103
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
51
104
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -55,11 +108,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
55
108
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
56
109
|
| `backdropFilter` | `string` | Raw CSS `backdrop-filter` value: what sits behind the widget is blurred through it, which is what makes a translucent card frosted glass. |
|
|
57
110
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
111
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
112
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
113
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
114
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
58
115
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
59
116
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
60
117
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
61
|
-
| `onPress` | `(
|
|
62
|
-
| `onClick` | `(
|
|
118
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
119
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
120
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
121
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
122
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
123
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
124
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
125
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
126
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
127
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
63
128
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
64
129
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
65
130
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|