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/SnackBar.md
CHANGED
|
@@ -37,7 +37,7 @@ const toast = SnackBar({
|
|
|
37
37
|
| `margin` | `number \| string` | Space outside the widget, between it and its neighbors. |
|
|
38
38
|
| `elevation` | `number` | Shadow depth. Higher values lift the widget off the page. |
|
|
39
39
|
| `animationDuration` | `number` | Duration for the animation, in milliseconds. |
|
|
40
|
-
| `zIndex` | `number` |
|
|
40
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
41
41
|
| `onShow` | `() => void` | Event handler for the `onShow` event. |
|
|
42
42
|
| `onClose` | `() => void` | Fired when the overlay closes. |
|
|
43
43
|
|
|
@@ -99,4 +99,4 @@ const toast = SnackBar({
|
|
|
99
99
|
- **Next:** [Tooltip](Tooltip.md)
|
|
100
100
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
101
101
|
|
|
102
|
-
You are reading **Chapter 4 · Feedback and overlays** (4 of
|
|
102
|
+
You are reading **Chapter 4 · Feedback and overlays** (4 of 11).
|
package/docs/widget/Stack.md
CHANGED
|
@@ -26,7 +26,7 @@ const stack = Stack({
|
|
|
26
26
|
| Prop | Type | Description |
|
|
27
27
|
| --- | --- | --- |
|
|
28
28
|
| `children` | `Widget[]` | An array of child widgets. Alias: `child` for a single child. |
|
|
29
|
-
| `position` | `'relative' \| 'absolute'` | CSS `position` value, or `stack` for centered stacking. |
|
|
29
|
+
| `position` | `'relative' \| 'absolute' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
30
30
|
| `alignment` | `'top-left' \| 'top-center' \| 'top-right' \| 'center-left' \| 'center' \| 'center-right' \| 'bottom-left' \| 'bottom-center' \| 'bottom-right'` | How children are aligned inside the stack. |
|
|
31
31
|
|
|
32
32
|
### Common props
|
|
@@ -35,11 +35,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
35
35
|
|
|
36
36
|
| Prop | Type | Description |
|
|
37
37
|
| --- | --- | --- |
|
|
38
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
39
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
40
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
41
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
42
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
43
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
44
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
45
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
46
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
47
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
48
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
49
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
50
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
51
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
52
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
53
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
54
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
38
55
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
39
56
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
40
57
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
58
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
59
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
60
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
61
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
62
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
63
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
64
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
65
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
66
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
67
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
68
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
69
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
70
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
71
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
72
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
73
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
74
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
75
|
+
| `fontSize` | `number` | Size of the font. |
|
|
76
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
77
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
41
78
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
79
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
80
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
81
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
82
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
83
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
84
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
85
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
86
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
42
87
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
88
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
89
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
90
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
91
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
92
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
93
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
94
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
95
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
43
96
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
97
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
45
98
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -49,11 +102,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
49
102
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
50
103
|
| `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. |
|
|
51
104
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
105
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
106
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
107
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
108
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
52
109
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
53
110
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
54
111
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
55
|
-
| `onPress` | `(
|
|
56
|
-
| `onClick` | `(
|
|
112
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
113
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
114
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
115
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
116
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
117
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
118
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
119
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
120
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
121
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
57
122
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
58
123
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
59
124
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
package/docs/widget/Stepper.md
CHANGED
|
@@ -38,7 +38,7 @@ const stepper = Stepper({
|
|
|
38
38
|
| `onFinish` | `() => void` | Event handler for the `onFinish` event. |
|
|
39
39
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
40
40
|
| `borderRadius` | `number` | Rounds the corners of the widget. |
|
|
41
|
-
| `border` | `string` |
|
|
41
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
42
42
|
| `borderColor` | `Color` | Color used for the border. |
|
|
43
43
|
| `borderWidth` | `number` | Width of the border. |
|
|
44
44
|
| `shadow` | `string` | Raw CSS `box-shadow` value, for a custom shadow. |
|
|
@@ -52,11 +52,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
52
52
|
|
|
53
53
|
| Prop | Type | Description |
|
|
54
54
|
| --- | --- | --- |
|
|
55
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
56
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
57
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
58
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
59
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
60
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
61
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
62
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
63
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
64
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
65
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
66
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
67
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
68
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
69
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
70
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
71
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
55
72
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
56
73
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
57
74
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
75
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
76
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
77
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
78
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
79
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
80
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
81
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
82
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
83
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
84
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
85
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
86
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
87
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
88
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
89
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
90
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
91
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
92
|
+
| `fontSize` | `number` | Size of the font. |
|
|
93
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
94
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
58
95
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
96
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
97
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
98
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
99
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
100
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
101
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
102
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
103
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
59
104
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
105
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
106
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
107
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
108
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
109
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
110
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
111
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
112
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
60
113
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
61
114
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
62
115
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -66,11 +119,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
66
119
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
67
120
|
| `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. |
|
|
68
121
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
122
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
123
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
124
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
125
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
69
126
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
70
127
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
71
128
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
72
|
-
| `onPress` | `(
|
|
73
|
-
| `onClick` | `(
|
|
129
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
130
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
131
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
132
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
133
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
134
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
135
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
136
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
137
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
138
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
74
139
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
75
140
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
76
141
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
package/docs/widget/Switch.md
CHANGED
|
@@ -23,7 +23,8 @@ const darkMode = Switch({
|
|
|
23
23
|
| Prop | Type | Description |
|
|
24
24
|
| --- | --- | --- |
|
|
25
25
|
| `value` | `boolean` | Current value controlled by the widget. |
|
|
26
|
-
| `onToggle` | `(value: boolean) => void` |
|
|
26
|
+
| `onToggle` | `(value: boolean) => void` | Deprecated alias of `onPress`. |
|
|
27
|
+
| `onPress` | `(value: boolean) => void` | Called with the new toggled state (`true` or `false`). |
|
|
27
28
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
28
29
|
| `size` | `'small' \| 'medium' \| 'large'` | Overall size preset or pixel value, depending on the widget. |
|
|
29
30
|
| `activeColor` | `Color` | Color used in the active state. |
|
|
@@ -35,11 +36,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
35
36
|
|
|
36
37
|
| Prop | Type | Description |
|
|
37
38
|
| --- | --- | --- |
|
|
39
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
40
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
41
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
42
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
43
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
44
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
45
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
46
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
47
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
48
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
49
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
50
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
51
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
52
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
53
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
54
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
55
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
38
56
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
39
57
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
40
58
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
59
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
60
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
61
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
62
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
63
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
64
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
65
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
66
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
67
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
68
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
69
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
70
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
71
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
72
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
73
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
74
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
75
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
76
|
+
| `fontSize` | `number` | Size of the font. |
|
|
77
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
78
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
41
79
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
80
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
81
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
82
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
83
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
84
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
85
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
86
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
87
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
42
88
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
89
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
90
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
91
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
92
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
93
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
94
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
95
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
96
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
43
97
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
44
98
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
45
99
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -49,11 +103,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
49
103
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
50
104
|
| `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. |
|
|
51
105
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
106
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
107
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
108
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
109
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
52
110
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
53
111
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
54
112
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
55
|
-
| `onPress` | `(
|
|
56
|
-
| `onClick` | `(
|
|
113
|
+
| `onPress` | `(event?: Event) => void` | Called with the new toggled state (`true` or `false`). |
|
|
114
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
115
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
116
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
117
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
118
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
119
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
120
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
121
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
122
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
57
123
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
58
124
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
59
125
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|
|
@@ -70,7 +136,7 @@ const notifications = Switch({
|
|
|
70
136
|
value: true,
|
|
71
137
|
label: "Notifications",
|
|
72
138
|
activeColor: "#16a34a",
|
|
73
|
-
|
|
139
|
+
onPress: (value) => console.log("notifications:", value),
|
|
74
140
|
});
|
|
75
141
|
```
|
|
76
142
|
|
|
@@ -85,7 +151,7 @@ const wifi = Switch({
|
|
|
85
151
|
size: "large",
|
|
86
152
|
activeColor: "#2563eb",
|
|
87
153
|
disabled: false,
|
|
88
|
-
|
|
154
|
+
onPress: (value) => {
|
|
89
155
|
console.log("wifi toggled:", value);
|
|
90
156
|
},
|
|
91
157
|
});
|
|
@@ -94,7 +160,7 @@ const wifi = Switch({
|
|
|
94
160
|
## Tips
|
|
95
161
|
|
|
96
162
|
- Reserve Switch for immediate settings and use Checkbox when the choice is part of a form you submit.
|
|
97
|
-
-
|
|
163
|
+
- onPress receives the new boolean, so you can store it directly in your state.
|
|
98
164
|
|
|
99
165
|
## Accessibility
|
|
100
166
|
|
|
@@ -102,7 +168,7 @@ const wifi = Switch({
|
|
|
102
168
|
|
|
103
169
|
## Behavior
|
|
104
170
|
|
|
105
|
-
- Switch works uncontrolled when value is omitted: clicking toggles the internal state and fires
|
|
171
|
+
- Switch works uncontrolled when value is omitted: clicking toggles the internal state and fires onPress.
|
|
106
172
|
- The returned element exposes getValue() and updateValue(v) to read or set the state without a click.
|
|
107
173
|
|
|
108
174
|
## Related widgets
|
|
@@ -119,4 +185,4 @@ const wifi = Switch({
|
|
|
119
185
|
- **Next:** [Slider](Slider.md)
|
|
120
186
|
- **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
|
|
121
187
|
|
|
122
|
-
You are reading **Chapter 2 · Interaction basics** (5 of
|
|
188
|
+
You are reading **Chapter 2 · Interaction basics** (5 of 9).
|
package/docs/widget/Text.md
CHANGED
|
@@ -27,15 +27,17 @@ const title = Text({
|
|
|
27
27
|
| `children` | `string` | An array of child widgets. Alias: `child` for a single child. |
|
|
28
28
|
| `size` | `number` | Overall size preset or pixel value, depending on the widget. |
|
|
29
29
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
30
|
-
| `weight` | `'normal' \| 'bold' \| number` | Font weight, such as `normal`, `bold`, or a number. |
|
|
30
|
+
| `weight` | `'normal' \| 'bold' \| 'bolder' \| 'lighter' \| '100' \| '200' \| '300' \| '400' \| '500' \| '600' \| '700' \| '800' \| '900' \| number` | Font weight, such as `normal`, `bold`, or a number. |
|
|
31
31
|
| `align` | `'left' \| 'center' \| 'right' \| 'justify'` | Horizontal text alignment. |
|
|
32
32
|
| `italic` | `boolean` | Renders the text in italics. |
|
|
33
33
|
| `decoration` | `'underline' \| 'line-through' \| 'overline'` | Text decoration such as `underline` or `line-through`. |
|
|
34
34
|
| `lineHeight` | `number \| string` | Line height as a number multiplier or CSS value. |
|
|
35
35
|
| `letterSpacing` | `number \| string` | Extra space between letters. |
|
|
36
|
+
| `textStroke` | `string` | The `textStroke` value for the widget. |
|
|
37
|
+
| `paintOrder` | `string` | The `paintOrder` value for the widget. |
|
|
36
38
|
| `type` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'p'` | Kind or mode of the widget. |
|
|
37
39
|
| `styles` | `Array<'bold' \| 'italic' \| 'underline' \| 'strikethrough' \| 'mark' \| 'small' \| 'code'>` | Extra inline styles applied to the text. |
|
|
38
|
-
| `onPress` | `(
|
|
40
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
39
41
|
|
|
40
42
|
### Common props
|
|
41
43
|
|
|
@@ -43,11 +45,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
43
45
|
|
|
44
46
|
| Prop | Type | Description |
|
|
45
47
|
| --- | --- | --- |
|
|
48
|
+
| `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
|
|
49
|
+
| `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
|
|
50
|
+
| `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
|
|
51
|
+
| `center` | `boolean` | Centres the widget on both axes in stack mode. |
|
|
52
|
+
| `centerY` | `boolean` | Centres the widget vertically in stack mode. |
|
|
53
|
+
| `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
|
|
54
|
+
| `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
|
|
55
|
+
| `z` | `number` | Alias of `zIndex`. |
|
|
56
|
+
| `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
|
|
57
|
+
| `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
|
|
58
|
+
| `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
|
|
59
|
+
| `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
|
|
60
|
+
| `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
|
|
61
|
+
| `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
|
|
62
|
+
| `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
|
|
63
|
+
| `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
|
|
64
|
+
| `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | CSS `position` value, or `stack` for centered stacking. |
|
|
46
65
|
| `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
|
|
47
66
|
| `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
|
|
48
67
|
| `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
|
|
68
|
+
| `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
|
|
69
|
+
| `minWidth` | `Size` | Minimum width the widget may shrink to. |
|
|
70
|
+
| `maxWidth` | `Size` | Maximum width the widget may grow to. |
|
|
71
|
+
| `minHeight` | `Size` | Minimum height the widget may shrink to. |
|
|
72
|
+
| `maxHeight` | `Size` | Maximum height the widget may grow to. |
|
|
73
|
+
| `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
|
|
74
|
+
| `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
|
|
75
|
+
| `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
|
|
76
|
+
| `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
|
|
77
|
+
| `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
|
|
78
|
+
| `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
|
|
79
|
+
| `display` | `string` | CSS `display` value for the container. |
|
|
80
|
+
| `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
|
|
81
|
+
| `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
|
|
82
|
+
| `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
|
|
83
|
+
| `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
|
|
84
|
+
| `gap` | `number \| string` | Space between children along the layout axis. |
|
|
85
|
+
| `fontSize` | `number` | Size of the font. |
|
|
86
|
+
| `borderColor` | `Color` | Color used for the border. |
|
|
87
|
+
| `borderWidth` | `number` | Width of the border. |
|
|
49
88
|
| `padding` | `Padding` | Space inside the widget, between its content and its border. |
|
|
89
|
+
| `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
|
|
90
|
+
| `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
|
|
91
|
+
| `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
|
|
92
|
+
| `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
|
|
93
|
+
| `pt` | `Size` | Alias of `paddingTop`. |
|
|
94
|
+
| `pr` | `Size` | Alias of `paddingRight`. |
|
|
95
|
+
| `pb` | `Size` | Alias of `paddingBottom`. |
|
|
96
|
+
| `pl` | `Size` | Alias of `paddingLeft`. |
|
|
50
97
|
| `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
|
|
98
|
+
| `marginTop` | `Size` | Space outside the widget, on the top edge only. |
|
|
99
|
+
| `marginRight` | `Size` | Space outside the widget, on the right edge only. |
|
|
100
|
+
| `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
|
|
101
|
+
| `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
|
|
102
|
+
| `mt` | `Size` | Alias of `marginTop`. |
|
|
103
|
+
| `mr` | `Size` | Alias of `marginRight`. |
|
|
104
|
+
| `mb` | `Size` | Alias of `marginBottom`. |
|
|
105
|
+
| `ml` | `Size` | Alias of `marginLeft`. |
|
|
51
106
|
| `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
|
|
52
107
|
| `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
|
|
53
108
|
| `color` | `Color` | Foreground color, usually the text or icon color. |
|
|
@@ -57,11 +112,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
|
|
|
57
112
|
| `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
|
|
58
113
|
| `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. |
|
|
59
114
|
| `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
|
|
115
|
+
| `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
|
|
116
|
+
| `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
|
|
117
|
+
| `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
|
|
118
|
+
| `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
|
|
60
119
|
| `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
|
|
61
120
|
| `visible` | `boolean` | Whether the widget is rendered and visible. |
|
|
62
121
|
| `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
|
|
63
|
-
| `onPress` | `(
|
|
64
|
-
| `onClick` | `(
|
|
122
|
+
| `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
|
|
123
|
+
| `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
|
|
124
|
+
| `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
|
|
125
|
+
| `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
|
|
126
|
+
| `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
|
|
127
|
+
| `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
|
|
128
|
+
| `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
|
|
129
|
+
| `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
|
|
130
|
+
| `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
|
|
131
|
+
| `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
|
|
65
132
|
| `id` | `string` | DOM `id` for the rendered element. |
|
|
66
133
|
| `className` | `string` | CSS class names applied to the rendered element. |
|
|
67
134
|
| `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
|