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/Radio.md
CHANGED
|
@@ -14,7 +14,7 @@ import { Radio } from "flet-box";
|
|
|
14
14
|
const plan = Radio({
|
|
15
15
|
label: "Monthly",
|
|
16
16
|
name: "billing",
|
|
17
|
-
|
|
17
|
+
onPress: (value) => console.log(value),
|
|
18
18
|
});
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -25,12 +25,13 @@ const plan = Radio({
|
|
|
25
25
|
| Prop | Type | Description |
|
|
26
26
|
| --- | --- | --- |
|
|
27
27
|
| `selected` | `boolean` | Current selected state. |
|
|
28
|
-
| `onSelect` | `(selected: boolean) => void` |
|
|
28
|
+
| `onSelect` | `(selected: boolean) => void` | Deprecated alias of `onPress`. |
|
|
29
|
+
| `onPress` | `(selected: boolean) => void` | Called with the new selected state (`true` or `false`). |
|
|
29
30
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
30
31
|
| `size` | `number` | Overall size preset or pixel value, depending on the widget. |
|
|
31
32
|
| `activeColor` | `Color` | Color used in the active state. |
|
|
32
33
|
| `label` | `string` | Label or caption shown near the control. |
|
|
33
|
-
| `name` | `string` |
|
|
34
|
+
| `name` | `string` | Value this option submits when it is the selected one. |
|
|
34
35
|
|
|
35
36
|
### Common props
|
|
36
37
|
|
|
@@ -38,11 +39,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
38
39
|
|
|
39
40
|
| Prop | Type | Description |
|
|
40
41
|
| --- | --- | --- |
|
|
42
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
43
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
44
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
45
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
46
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
47
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
48
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
49
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
50
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
51
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
52
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
53
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
54
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
55
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
57
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
58
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
41
59
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
42
60
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
43
61
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
62
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
63
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
64
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
65
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
66
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
67
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
68
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
69
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
70
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
71
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
72
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
73
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
74
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
75
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
76
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
77
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
78
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
79
|
+
| `fontSize` | `number` | Size of the font. |
|
|
80
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
81
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
44
82
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
83
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
84
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
85
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
86
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
87
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
88
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
89
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
90
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
45
91
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
92
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
93
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
94
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
95
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
96
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
97
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
98
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
99
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
46
100
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
47
101
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
48
102
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -52,11 +106,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
52
106
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
53
107
|
| `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. |
|
|
54
108
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
109
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
110
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
111
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
112
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
55
113
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
56
114
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
57
115
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
58
|
-
| `onPress` | `(
|
|
59
|
-
| `onClick` | `(
|
|
116
|
+
| `onPress` | `(event?: Event) => void` | Called with the new selected state (`true` or `false`). |
|
|
117
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
118
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
119
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
120
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
121
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
122
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
123
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
124
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
125
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
60
126
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
61
127
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
62
128
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -74,7 +140,7 @@ const monthly = Radio({
|
|
|
74
140
|
name: "billing",
|
|
75
141
|
selected: true,
|
|
76
142
|
activeColor: "#2563eb",
|
|
77
|
-
|
|
143
|
+
onPress: (value) => console.log("billing:", value),
|
|
78
144
|
});
|
|
79
145
|
```
|
|
80
146
|
|
|
@@ -90,7 +156,7 @@ const option = Radio({
|
|
|
90
156
|
disabled: false,
|
|
91
157
|
activeColor: "#16a34a",
|
|
92
158
|
size: 24,
|
|
93
|
-
|
|
159
|
+
onPress: (value) => {
|
|
94
160
|
console.log("shipping changed:", value);
|
|
95
161
|
},
|
|
96
162
|
});
|
|
@@ -99,7 +165,7 @@ const option = Radio({
|
|
|
99
165
|
## Tips
|
|
100
166
|
|
|
101
167
|
- Give Radios that answer the same question the same name; selecting one clears the others in that group.
|
|
102
|
-
- Set selected for the initial choice and let
|
|
168
|
+
- Set selected for the initial choice and let onPress write the change back into your own state.
|
|
103
169
|
|
|
104
170
|
## Accessibility
|
|
105
171
|
|
|
@@ -107,7 +173,7 @@ const option = Radio({
|
|
|
107
173
|
|
|
108
174
|
## Behavior
|
|
109
175
|
|
|
110
|
-
- Clicking an already-selected Radio is a no-op, so
|
|
176
|
+
- Clicking an already-selected Radio is a no-op, so onPress only fires when the selection actually changes.
|
|
111
177
|
- The returned element exposes select(), unselect() and isSelected() for programmatic control.
|
|
112
178
|
|
|
113
179
|
## Related widgets
|
|
@@ -124,4 +190,4 @@ const option = Radio({
|
|
|
124
190
|
- **Next:** [Switch](Switch.md)
|
|
125
191
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
126
192
|
|
|
127
|
-
You are reading **Chapter 2 · Interaction basics** (4 of
|
|
193
|
+
You are reading **Chapter 2 · Interaction basics** (4 of 9).
|
package/docs/widget/Rating.md
CHANGED
|
@@ -44,11 +44,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
44
44
|
|
|
45
45
|
| Prop | Type | Description |
|
|
46
46
|
| --- | --- | --- |
|
|
47
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
48
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
49
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
50
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
51
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
52
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
53
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
54
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
55
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
56
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
57
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
58
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
59
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
60
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
61
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
62
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
63
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
47
64
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
48
65
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
49
66
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
67
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
68
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
69
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
70
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
71
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
72
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
73
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
74
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
75
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
76
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
77
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
78
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
79
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
80
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
81
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
82
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
83
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
84
|
+
| `fontSize` | `number` | Size of the font. |
|
|
85
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
86
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
50
87
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
88
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
89
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
90
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
91
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
92
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
93
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
94
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
95
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
51
96
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
97
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
98
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
99
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
100
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
101
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
102
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
103
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
104
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
52
105
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
53
106
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
54
107
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -58,11 +111,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
58
111
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
59
112
|
| `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. |
|
|
60
113
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
114
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
115
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
116
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
117
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
61
118
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
62
119
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
63
120
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
64
|
-
| `onPress` | `(
|
|
65
|
-
| `onClick` | `(
|
|
121
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
122
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
123
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
124
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
125
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
126
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
127
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
128
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
129
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
130
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
66
131
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
67
132
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
68
133
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -117,8 +182,7 @@ const rating = Rating({
|
|
|
117
182
|
|
|
118
183
|
- onChange receives the numeric value each time the user picks a rating.
|
|
119
184
|
- readOnly disables onChange while keeping the current value visible.
|
|
120
|
-
- An unfilled star uses the palette's control grey and a filled one its readable
|
|
121
|
-
- amber, so both states clear 3:1 against the surface they sit on.
|
|
185
|
+
- An unfilled star uses the palette's control grey and a filled one its readable amber, so both states clear 3:1 against the surface they sit on.
|
|
122
186
|
|
|
123
187
|
## Related widgets
|
|
124
188
|
|
|
@@ -131,7 +195,7 @@ const rating = Rating({
|
|
|
131
195
|
## Continue reading
|
|
132
196
|
|
|
133
197
|
- **Previous:** [Dropdown](Dropdown.md)
|
|
134
|
-
- **Next:** [
|
|
198
|
+
- **Next:** [ThemePicker](ThemePicker.md)
|
|
135
199
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
136
200
|
|
|
137
|
-
You are reading **Chapter 2 · Interaction basics** (8 of
|
|
201
|
+
You are reading **Chapter 2 · Interaction basics** (8 of 9).
|
package/docs/widget/Row.md
CHANGED
|
@@ -31,7 +31,7 @@ const row = Row({
|
|
|
31
31
|
| `alignItems` | `ContainerProps['alignItems']` | Aligns children across the cross axis (CSS `align-items`). |
|
|
32
32
|
| `wrap` | `boolean \| 'wrap' \| 'nowrap' \| 'wrap-reverse'` | Lets children wrap onto multiple lines. |
|
|
33
33
|
| `children` | `Widget[]` | An array of child widgets. Alias: `child` for a single child. |
|
|
34
|
-
| `onPress` | `(
|
|
34
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
35
35
|
|
|
36
36
|
### Common props
|
|
37
37
|
|
|
@@ -39,11 +39,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
39
39
|
|
|
40
40
|
| Prop | Type | Description |
|
|
41
41
|
| --- | --- | --- |
|
|
42
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
43
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
44
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
45
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
46
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
47
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
48
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
49
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
50
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
51
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
52
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
53
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
54
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
55
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
56
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
57
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
58
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
42
59
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
43
60
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
44
61
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
62
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
63
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
64
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
65
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
66
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
67
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
68
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
69
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
70
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
71
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
72
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
73
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
74
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
75
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
76
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
77
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
78
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
79
|
+
| `fontSize` | `number` | Size of the font. |
|
|
80
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
81
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
45
82
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
83
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
84
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
85
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
86
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
87
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
88
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
89
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
90
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
46
91
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
92
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
93
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
94
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
95
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
96
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
97
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
98
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
99
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
47
100
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
48
101
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
49
102
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -53,11 +106,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
53
106
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
54
107
|
| `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. |
|
|
55
108
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
109
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
110
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
111
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
112
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
56
113
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
57
114
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
58
115
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
59
|
-
| `onPress` | `(
|
|
60
|
-
| `onClick` | `(
|
|
116
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
117
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
118
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
119
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
120
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
121
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
122
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
123
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
124
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
125
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
61
126
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
62
127
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
63
128
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
package/docs/widget/Skeleton.md
CHANGED
|
@@ -42,11 +42,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
42
42
|
|
|
43
43
|
| Prop | Type | Description |
|
|
44
44
|
| --- | --- | --- |
|
|
45
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
46
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
47
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
48
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
49
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
50
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
51
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
52
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
53
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
54
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
55
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
56
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
57
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
58
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
59
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
60
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
61
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
45
62
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
46
63
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
47
64
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
65
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
66
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
67
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
68
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
69
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
70
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
71
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
72
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
73
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
74
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
75
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
76
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
77
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
78
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
79
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
80
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
81
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
82
|
+
| `fontSize` | `number` | Size of the font. |
|
|
83
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
84
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
48
85
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
86
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
87
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
88
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
89
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
90
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
91
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
92
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
93
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
49
94
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
95
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
96
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
97
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
98
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
99
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
100
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
101
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
102
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
50
103
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
51
104
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
52
105
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -56,11 +109,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
56
109
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
57
110
|
| `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. |
|
|
58
111
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
112
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
113
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
114
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
115
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
59
116
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
60
117
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
61
118
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
62
|
-
| `onPress` | `(
|
|
63
|
-
| `onClick` | `(
|
|
119
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
120
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
121
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
122
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
123
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
124
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
125
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
126
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
127
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
128
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
64
129
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
65
130
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
66
131
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -131,4 +196,4 @@ const cardPlaceholder = Skeleton({
|
|
|
131
196
|
- **Next:** [FloatingActionButton](FloatingActionButton.md)
|
|
132
197
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
133
198
|
|
|
134
|
-
You are reading **Chapter 4 · Feedback and overlays** (
|
|
199
|
+
You are reading **Chapter 4 · Feedback and overlays** (9 of 11).
|
package/docs/widget/Slider.md
CHANGED
|
@@ -31,6 +31,7 @@ const volume = Slider({
|
|
|
31
31
|
| `height` | `number` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
32
32
|
| `thumbSize` | `number` | Size of the slider thumb. |
|
|
33
33
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
34
|
+
| `thumbColor` | `Color` | Color used for the thumb. |
|
|
34
35
|
| `trackColor` | `Color` | Color of the slider track. |
|
|
35
36
|
| `orientation` | `'horizontal' \| 'vertical'` | Orientation of the widget or control. |
|
|
36
37
|
| `inverted` | `boolean` | Reverses the direction of the control. |
|
|
@@ -43,8 +44,8 @@ const volume = Slider({
|
|
|
43
44
|
| `animatedStripes` | `boolean` | Animates the stripes on the bar. |
|
|
44
45
|
| `stripeColor` | `string` | Color used for the stripe. |
|
|
45
46
|
| `glow` | `boolean` | Adds a glow around the widget. |
|
|
46
|
-
| `onPress` | `(value: number) => void` |
|
|
47
|
-
| `onChanged` | `(value: number) => void` |
|
|
47
|
+
| `onPress` | `(value: number) => void` | Called with the new value while the thumb moves. |
|
|
48
|
+
| `onChanged` | `(value: number) => void` | Deprecated alias of `onPress`. |
|
|
48
49
|
| `onChangeEnd` | `(value: number) => void` | Event handler for the `onChangeEnd` event. |
|
|
49
50
|
|
|
50
51
|
### Common props
|
|
@@ -53,11 +54,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
53
54
|
|
|
54
55
|
| Prop | Type | Description |
|
|
55
56
|
| --- | --- | --- |
|
|
57
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
58
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
59
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
60
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
61
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
62
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
63
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
64
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
65
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
66
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
67
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
68
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
69
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
70
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
71
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
72
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
73
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
56
74
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
57
75
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
58
76
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
77
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
78
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
79
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
80
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
81
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
82
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
83
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
84
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
85
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
86
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
87
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
88
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
89
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
90
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
91
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
92
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
93
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
94
|
+
| `fontSize` | `number` | Size of the font. |
|
|
95
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
96
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
59
97
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
98
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
99
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
100
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
101
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
102
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
103
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
104
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
105
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
60
106
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
107
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
108
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
109
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
110
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
111
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
112
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
113
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
114
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
61
115
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
62
116
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
63
117
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -67,11 +121,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
67
121
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
68
122
|
| `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. |
|
|
69
123
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
124
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
125
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
126
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
127
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
70
128
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
71
129
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
72
130
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
73
|
-
| `onPress` | `(
|
|
74
|
-
| `onClick` | `(
|
|
131
|
+
| `onPress` | `(event?: Event) => void` | Called with the new value while the thumb moves. |
|
|
132
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
133
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
134
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
135
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
136
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
137
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
138
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
139
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
140
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
75
141
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
76
142
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
77
143
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -89,7 +155,7 @@ const volume = Slider({
|
|
|
89
155
|
min: 0,
|
|
90
156
|
max: 100,
|
|
91
157
|
step: 5,
|
|
92
|
-
|
|
158
|
+
onPress: (value) => console.log("volume:", value),
|
|
93
159
|
});
|
|
94
160
|
```
|
|
95
161
|
|
|
@@ -114,14 +180,14 @@ const price = Slider({
|
|
|
114
180
|
{ value: 500, label: "$500" },
|
|
115
181
|
{ value: 1000, label: "$1000" },
|
|
116
182
|
],
|
|
117
|
-
|
|
183
|
+
onPress: (value) => console.log("price:", value),
|
|
118
184
|
onChangeEnd: (value) => console.log("final:", value),
|
|
119
185
|
});
|
|
120
186
|
```
|
|
121
187
|
|
|
122
188
|
## Tips
|
|
123
189
|
|
|
124
|
-
-
|
|
190
|
+
- onPress fires continuously while dragging; use onChangeEnd for the value to commit, such as a filter request.
|
|
125
191
|
- Set step to snap to meaningful increments instead of every integer.
|
|
126
192
|
- On a vertical slider, width is the rail's length and height its thickness.
|
|
127
193
|
|
|
@@ -131,7 +197,7 @@ const price = Slider({
|
|
|
131
197
|
|
|
132
198
|
## Behavior
|
|
133
199
|
|
|
134
|
-
- Dragging the track or thumb updates the value and fires
|
|
200
|
+
- Dragging the track or thumb updates the value and fires onPress; releasing fires onChangeEnd once.
|
|
135
201
|
- The returned element exposes value, min, max, step, setValue() and getValue(), and disconnects its ResizeObserver on unmount.
|
|
136
202
|
- During a drag the fill follows the pointer with no easing; the 0.1s ease belongs to a value that changes by itself, from a key press or setValue().
|
|
137
203
|
|
|
@@ -149,4 +215,4 @@ const price = Slider({
|
|
|
149
215
|
- **Next:** [Dropdown](Dropdown.md)
|
|
150
216
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
151
217
|
|
|
152
|
-
You are reading **Chapter 2 · Interaction basics** (6 of
|
|
218
|
+
You are reading **Chapter 2 · Interaction basics** (6 of 9).
|