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.
Files changed (154) hide show
  1. package/AGENTS_FOR_CODE_GEN.md +284 -0
  2. package/CONTRIBUTING.md +238 -0
  3. package/README.md +2 -2
  4. package/bin/cli.js +88 -1
  5. package/bin/commands/auditFix.js +181 -27
  6. package/bin/commands/checkApi.js +14 -3
  7. package/bin/commands/checkStructure.js +368 -0
  8. package/bin/commands/checkSyntax.js +293 -0
  9. package/bin/commands/checkUi.js +666 -14
  10. package/bin/commands/create.js +14 -0
  11. package/bin/commands/createBundle.js +2 -2
  12. package/bin/commands/metrics.js +448 -0
  13. package/bin/commands/release.js +18 -0
  14. package/bin/commands/report.js +849 -0
  15. package/bin/commands/tools.js +76 -0
  16. package/bin/commands/unpack.js +39 -11
  17. package/bin/commands/verify.js +879 -0
  18. package/bin/mcp.js +280 -0
  19. package/bin/utils/contract.js +27 -0
  20. package/bin/utils/dtsProps.js +5 -1
  21. package/bin/utils/migrationGuide.js +146 -0
  22. package/bin/utils/moduleExports.js +9 -5
  23. package/bin/utils/templates.js +225 -18
  24. package/bin/utils/toolkit.js +191 -0
  25. package/docs/README.md +5 -1
  26. package/docs/arquitectura.md +1 -1
  27. package/docs/cli/README.md +168 -2
  28. package/docs/guides/README.md +6 -0
  29. package/docs/guides/accessibility.md +2 -1
  30. package/docs/guides/ai-toolkit.md +166 -0
  31. package/docs/guides/compatibility.md +1 -1
  32. package/docs/guides/migration.md +92 -0
  33. package/docs/guides/minification-and-protection.md +2 -1
  34. package/docs/guides/mobile-and-platforms.md +1 -1
  35. package/docs/guides/online-updates.md +2 -0
  36. package/docs/server/deployment.md +1 -1
  37. package/docs/tools/styling.md +2 -2
  38. package/docs/tools/theme.md +139 -4
  39. package/docs/widget/Accordion.md +74 -8
  40. package/docs/widget/AdMob.md +68 -3
  41. package/docs/widget/AdSense.md +67 -2
  42. package/docs/widget/AlertDialog.md +1 -1
  43. package/docs/widget/AnimatedBox.md +80 -39
  44. package/docs/widget/AnimatedText.md +74 -18
  45. package/docs/widget/Audio.md +73 -14
  46. package/docs/widget/Avatar.md +69 -4
  47. package/docs/widget/Badge.md +68 -3
  48. package/docs/widget/BottomSheet.md +2 -2
  49. package/docs/widget/Button.md +69 -3
  50. package/docs/widget/Card.md +69 -4
  51. package/docs/widget/Carousel.md +67 -2
  52. package/docs/widget/Chart.md +67 -2
  53. package/docs/widget/Checkbox.md +74 -8
  54. package/docs/widget/Chip.md +68 -3
  55. package/docs/widget/CircularBar.md +74 -15
  56. package/docs/widget/CircularChart.md +71 -10
  57. package/docs/widget/CodeViewer.md +67 -2
  58. package/docs/widget/Column.md +68 -3
  59. package/docs/widget/Container.md +68 -3
  60. package/docs/widget/DataTable.md +67 -2
  61. package/docs/widget/Divider.md +67 -2
  62. package/docs/widget/DraggBox.md +67 -2
  63. package/docs/widget/Dropdown.md +76 -10
  64. package/docs/widget/DroppBox.md +67 -2
  65. package/docs/widget/FloatingActionButton.md +68 -3
  66. package/docs/widget/GridView.md +67 -2
  67. package/docs/widget/Icon.md +71 -5
  68. package/docs/widget/Image.md +68 -3
  69. package/docs/widget/Input.md +68 -3
  70. package/docs/widget/Inspector.md +2 -2
  71. package/docs/widget/InstallButton.md +73 -13
  72. package/docs/widget/ListTile.md +69 -3
  73. package/docs/widget/ListView.md +67 -2
  74. package/docs/widget/Maps.md +68 -3
  75. package/docs/widget/Markdown.md +74 -15
  76. package/docs/widget/MatrixRain.md +72 -11
  77. package/docs/widget/Menu.md +209 -0
  78. package/docs/widget/Modal.md +3 -3
  79. package/docs/widget/Pagination.md +68 -3
  80. package/docs/widget/ParallaxBox.md +72 -12
  81. package/docs/widget/ProgressBar.md +69 -4
  82. package/docs/widget/QRCode.md +67 -2
  83. package/docs/widget/README.md +54 -50
  84. package/docs/widget/Radio.md +76 -10
  85. package/docs/widget/Rating.md +70 -6
  86. package/docs/widget/Row.md +68 -3
  87. package/docs/widget/Skeleton.md +68 -3
  88. package/docs/widget/Slider.md +75 -9
  89. package/docs/widget/SnackBar.md +2 -2
  90. package/docs/widget/Stack.md +68 -3
  91. package/docs/widget/Stepper.md +68 -3
  92. package/docs/widget/Switch.md +74 -8
  93. package/docs/widget/Text.md +71 -4
  94. package/docs/widget/ThemePicker.md +197 -0
  95. package/docs/widget/Tooltip.md +72 -7
  96. package/docs/widget/TreeView.md +70 -10
  97. package/docs/widget/Video.md +71 -10
  98. package/package.json +10 -3
  99. package/skills/fletbox-design/SKILL.md +89 -5
  100. package/skills/fletbox-motion/SKILL.md +1 -1
  101. package/skills/fletbox-rules/SKILL.md +56 -4
  102. package/src/core/runApp.js +12 -0
  103. package/src/index.d.ts +374 -101
  104. package/src/index.js +9 -0
  105. package/src/navigations/AdaptiveScaffold.js +2 -2
  106. package/src/navigations/BottomNavigation.js +1 -1
  107. package/src/navigations/Scaffold.js +18 -6
  108. package/src/tools/useState.js +11 -4
  109. package/src/utils/colors.js +275 -0
  110. package/src/utils/errorBoundary.js +288 -0
  111. package/src/utils/index.js +10 -2
  112. package/src/utils/stackPosition.js +39 -24
  113. package/src/utils/syntaxHighlight.js +4 -1
  114. package/src/utils/themes.js +279 -3
  115. package/src/widget-factory/addChildren.js +17 -10
  116. package/src/widget-factory/assignProps.js +18 -6
  117. package/src/widget-factory/createWidget.js +7 -0
  118. package/src/widget-factory/deprecations.js +77 -0
  119. package/src/widget-factory/translateProps.js +11 -1
  120. package/src/widget-factory/warnings.js +1 -27
  121. package/src/widget-factory/widgetFactory.js +59 -17
  122. package/src/widgets/Accordion.js +21 -7
  123. package/src/widgets/Badge.js +11 -2
  124. package/src/widgets/Button.js +15 -3
  125. package/src/widgets/Carousel.js +12 -4
  126. package/src/widgets/Chart.js +7 -2
  127. package/src/widgets/Checkbox.js +1 -2
  128. package/src/widgets/Chip.js +24 -10
  129. package/src/widgets/CircularBar.js +9 -3
  130. package/src/widgets/CircularChart.js +5 -3
  131. package/src/widgets/Container.js +6 -0
  132. package/src/widgets/Divider.js +3 -1
  133. package/src/widgets/DraggBox.js +9 -0
  134. package/src/widgets/Dropdown.js +3 -3
  135. package/src/widgets/DroppBox.js +5 -0
  136. package/src/widgets/FloatingActionButton.js +1 -1
  137. package/src/widgets/Icon.js +5 -1
  138. package/src/widgets/InstallButton.js +4 -2
  139. package/src/widgets/Markdown.js +171 -103
  140. package/src/widgets/Menu.js +340 -0
  141. package/src/widgets/Modal.js +7 -1
  142. package/src/widgets/Pagination.js +10 -5
  143. package/src/widgets/ProgressBar.js +5 -4
  144. package/src/widgets/QRCode.js +4 -0
  145. package/src/widgets/Radio.js +1 -2
  146. package/src/widgets/Rating.js +9 -0
  147. package/src/widgets/Slider.js +4 -1
  148. package/src/widgets/SnackBar.js +2 -2
  149. package/src/widgets/Switch.js +1 -2
  150. package/src/widgets/Text.js +9 -5
  151. package/src/widgets/ThemePicker.js +234 -0
  152. package/src/widgets/TreeView.js +2 -1
  153. package/src/widgets/index.js +2 -0
  154. package/docs/CONTRIBUTING.md +0 -156
@@ -1,17 +1,31 @@
1
1
  # Themes
2
2
 
3
3
  ## Overview
4
- FletBox ships a built-in color system: `colors` is the palette of the current theme, `palettes` holds all named palettes, and the theme functions switch between light and dark, subscribe to changes, and follow the system preference. A `ThemeProvider` and the `useTheme()` hook wrap them for component-based apps.
4
+ FletBox ships a built-in color system: `colors` is the palette of the current theme, `palettes` holds all named palettes, and the theme functions switch between light and dark, subscribe to changes, and follow the system preference. On top of that sit the accent presets — selectable hue families that paint `colors.primary`, its ink and its wash over whichever palette is active — and the theme functions carry them too. A `ThemeProvider` and the `useTheme()` hook wrap all of it for component-based apps.
5
5
 
6
6
  ## When to use
7
7
  - Style widgets with semantic tokens (`colors.surface`, `colors.primary`, `colors.error`) instead of hard-coded hex values.
8
8
  - Add a light/dark toggle that re-colors the whole app instantly.
9
9
  - Follow the OS dark/light setting automatically.
10
+ - Let the reader pick the app's color — buttons, icons and plates and all — with [`ThemePicker`](../widget/ThemePicker.md) and `setAccent`.
10
11
 
11
12
  ## Import
12
13
 
13
14
  ```javascript
14
- import { colors, setTheme, registerPalette, toggleTheme, subscribeTheme, ThemeProvider } from "flet-box";
15
+ import {
16
+ colors,
17
+ setTheme,
18
+ registerPalette,
19
+ toggleTheme,
20
+ subscribeTheme,
21
+ ThemeProvider,
22
+ registerAccent,
23
+ setAccent,
24
+ applyAccentPreference,
25
+ getAccent,
26
+ getAccentSurfaces,
27
+ listAccents,
28
+ } from "flet-box";
15
29
  ```
16
30
 
17
31
  ## Functions
@@ -20,6 +34,13 @@ import { colors, setTheme, registerPalette, toggleTheme, subscribeTheme, ThemePr
20
34
  | --- | --- | --- | --- |
21
35
  | `setTheme` | `setTheme('light' \| 'dark')` | `Record<string, string>` | Switch the active palette. |
22
36
  | `registerPalette` | `registerPalette(themeName, palette)` | `Record<string, string>` | Merge brand tokens into a named palette and repaint the page. |
37
+ | `registerAccent` | `registerAccent({ id, label?, light, dark })` | `Accent \| null` | Add or replace one selectable accent. Each end of the pair is a hex or a five-stop ramp; `null` means the argument was unusable. |
38
+ | `setAccent` | `setAccent(id \| null, { surfaces? })` | `Record<string, string>` | Lay an accent over the live palette and store the choice. `surfaces: true` paints the page and its panels from the same ramp. `null`, or an id nothing registered, takes it back off. |
39
+ | `applyAccentPreference` | `applyAccentPreference(id, { surfaces? })` | `string \| null` | Paint the app's own brand at boot, and only when the reader has never picked one. Never stores anything. |
40
+ | `getAccent` | `getAccent()` | `string \| null` | The accent id on screen, or `null` while the palette's own `primary` shows. |
41
+ | `getAccentSurfaces` | `getAccentSurfaces()` | `boolean` | Whether the live accent also paints the surfaces, or only the brand. |
42
+ | `listAccents` | `listAccents()` | `Accent[]` | Every selectable family, in registration order — `{ id, label, light, dark }`. |
43
+ | `listAccentRamps` | `listAccentRamps()` | `Array` | The same families with all five stops of each theme beside them, for a swatch that shows the whole ramp. |
23
44
  | `getTheme` | `getTheme()` | `string` | The active theme name. |
24
45
  | `toggleTheme` | `toggleTheme()` | `string` | Flip light/dark and return the new name. |
25
46
  | `getColor` | `getColor(name, opacity?)` | `string` | Resolve a token (optionally with alpha). |
@@ -27,7 +48,7 @@ import { colors, setTheme, registerPalette, toggleTheme, subscribeTheme, ThemePr
27
48
  | `applySystemTheme` | `applySystemTheme()` | `string` | Apply light/dark from the OS preference. |
28
49
  | `watchSystemTheme` | `watchSystemTheme()` | `() => void` | Follow the OS preference live; returns an unsubscribe function. |
29
50
  | `ThemeProvider` | `ThemeProvider({ children, theme? })` | `Widget` | Provide a theme (defaults to system) for a subtree. |
30
- | `useTheme` | `useTheme()` | object | `{ colors, setTheme, getTheme, toggleTheme, getColor, applySystemTheme }`. |
51
+ | `useTheme` | `useTheme()` | object | `{ colors, setTheme, getTheme, toggleTheme, getColor, applySystemTheme, setAccent, getAccent, listAccents }`. |
31
52
 
32
53
  Plus the constants: `colors` (current palette) and `palettes` (all named palettes, keyed by name).
33
54
 
@@ -36,9 +57,10 @@ Plus the constants: `colors` (current palette) and `palettes` (all named palette
36
57
  Every token is available on `colors`:
37
58
 
38
59
  - **Brand:** `primary`, `secondary`, `info`, `success`, `warning`, `danger`, `error`.
60
+ - **On a fill:** `onPrimary` — the ink the theme puts on a `primary` plate. Ask the theme for it; a literal `#ffffff` is a bug the moment the reader picks a pale accent.
39
61
  - **Surfaces:** `background`, `surface`, `card`, `overlay`.
40
62
  - **Text:** `text`, `textSecondary`, `textDisabled`, `divider`, `border`, `shadow`.
41
- - **Tints:** `gray50` … `gray900`, plus the soft backgrounds `errorBg`, `successBg`, `warningBg`, `infoBg`.
63
+ - **Tints:** `gray50` … `gray900`, plus the soft backgrounds `primaryBg`, `errorBg`, `successBg`, `warningBg`, `infoBg`.
42
64
  - **Glass:** `glass` (the translucent surface) and `glassBorder` (its rim), meant to pair with `backdropFilter`. Light is white glass, dark is a slate pane with a light rim.
43
65
 
44
66
  The `dark` palette overrides the surface/text tokens; `gray*` and brand colors also shift to keep contrast. Read [the palette walkthrough](../guides/utilities.md) for usage patterns.
@@ -80,6 +102,118 @@ it at the bottom of `src/database/themes.js` — the same file that declares
80
102
  `lightColors` and `darkColors` — so a project that edits its brand colors is
81
103
  already correct without touching `src/app.js`.
82
104
 
105
+ ## Accent presets: `setAccent`
106
+
107
+ `registerPalette` says what a theme is. An **accent** is what the reader picks
108
+ inside it: one hue family painted over the palette's `primary`, its ink and its
109
+ wash, so every button, icon and selected plate on the screen moves together.
110
+ Twelve families ship (`listAccents()`), and each is a *pair* — the stop that hue
111
+ wears on a light page and the stop it wears on a dark one — which is why a
112
+ [`ThemePicker`](../widget/ThemePicker.md) swatch is split down the middle.
113
+ Worn with `surfaces: true`, the same family paints the page and its panels too,
114
+ and the picker is choosing a **theme** rather than a brand color; see
115
+ [Worn as a theme](#worn-as-a-theme) below.
116
+
117
+ ```javascript
118
+ import { ThemePicker, applyAccentPreference, listAccents } from "flet-box";
119
+
120
+ // At boot: the app's own brand, and only if the reader has never chosen.
121
+ applyAccentPreference("teal");
122
+
123
+ // In a settings sheet: the reader's choice, which paints and persists.
124
+ ThemePicker({
125
+ accents: listAccents().filter((a) => ["teal", "blue", "rose", "orange"].includes(a.id)),
126
+ size: 48,
127
+ onChange: (id) => console.log("accent:", id),
128
+ });
129
+ ```
130
+
131
+ What it does:
132
+
133
+ - **It is a layer, not a second palette.** The one repaint funnel lays the
134
+ accent's `primary`, `onPrimary` and `primaryBg` over the theme's own tokens, so
135
+ a toggle, an OS flip or a `setTheme` from anywhere keeps the choice instead of
136
+ writing the brand back over it. The `--color-*` properties and the PWA status
137
+ bar move with it because they read the same tokens. Worn with `surfaces: true`
138
+ the same funnel lays five more tokens down — `background`, `surface`, `card`,
139
+ `border`, `divider` — and nothing else changes hands.
140
+ - **`setAccent` is the reader's verb, `applyAccentPreference` is the app's.** The
141
+ first stores `"fletbox-accent"`, so the picker opens on the answer the reader
142
+ gave; the second paints without storing, so it is a default the reader can
143
+ overrule and never a choice written into their name. An unknown id changes
144
+ nothing, and `setAccent(null)` gives the palette its own brand back.
145
+ - **A created app opens on `neutral`.** `flet-box create` writes
146
+ `applyAccentPreference("neutral")` at the bottom of `src/database/themes.js`,
147
+ beside the `registerPalette` calls that carry the same three values, so a new
148
+ project reads as paper and type rather than as somebody else's brand: the
149
+ accent is the page's own ink, near-black on a light page and near-white on a
150
+ dark one. The first thing a designer changes is that id — and the Preferences
151
+ screen already ships a `ThemePicker`, so a reader can change it without them.
152
+ - **A family is measured before it ships.** Each pair clears the numbers a
153
+ hand-built palette has to as well: white or near-black words on the accent at
154
+ 4.5:1, the accent as text on the page at 4.5:1 and as a glyph on a card at 3:1,
155
+ page ink, secondary ink and the accent itself on its wash at 4.5:1, and the
156
+ wash lifting off the background by 1.04 to 1.5. `#3b82f6` fails the first one —
157
+ white words measure 3.15:1 on it — which is why an accent is a stop on a ramp
158
+ and never the middle of one.
159
+ - **A brand the list lacks is registered, not typed.**
160
+ `registerAccent` takes an `id`, a `label` and a `light`/`dark` pair: one hex
161
+ each, and the wash and `colors.onPrimary` are derived, or a five-stop ramp whose
162
+ stop 0 (light) and stop 1 (dark) are the ones painted. The call belongs in
163
+ `src/database/themes.js`, beside the palette it feeds.
164
+
165
+ ### Worn as a theme
166
+
167
+ `setAccent(id, { surfaces: true })` is how an app lets the reader pick the color
168
+ of the *page* and not only of its buttons. Five more tokens arrive off the same
169
+ five stops the swatch paints, in the order a designer would build them by hand:
170
+
171
+ | Token | Light, from the ramp | Dark, from the ramp |
172
+ | --- | --- | --- |
173
+ | `background` | `ramp[4]` — the palest stop | `ramp[3]` scaled to 10% |
174
+ | `surface` | `ramp[3]` — the measured wash stop | `ramp[3]` scaled to 18% |
175
+ | `card` | `#ffffff`, the way it lifts off `#fafafa` today | `ramp[3]` scaled to 28% |
176
+ | `border`, `divider` | `ramp[3]` darkened 6% | `ramp[3]` scaled to 45% |
177
+
178
+ Teal, measured: a light page `#f0fdfa` with `#ccfbf1` panels, white cards and
179
+ `#c0ece3` hairlines; a dark page `#010c0b` with `#031514` panels, `#04211f`
180
+ cards and `#073531` hairlines. `applyAccentPreference("teal", { surfaces: true })`
181
+ boots an app in that theme for a reader who has never chosen.
182
+
183
+ Three rules the derivation keeps, and every one of them is measured by
184
+ `tests/regression.test.js` ("an accent worn as a theme keeps every ink on the
185
+ surfaces it paints") for all twelve families in both themes:
186
+
187
+ - **Only the surfaces move.** `text`, `textSecondary`, `textDisabled`, the brand
188
+ trio and every semantic signal — `success`, `danger`, their plates and alert
189
+ tints — answer the same values they had worn as a brand-only accent. The neutral
190
+ ink scale was measured against a near-white and a near-black page, and a tinted
191
+ stop of a saturated family sits within a few percent of both, so the text needs
192
+ re-measuring rather than re-deriving; and a tinted theme still has to be able to
193
+ say "this failed" in a hue that is not its own.
194
+ - **Dark scales toward black, never toward white.** Multiplying a channel keeps the
195
+ hue exactly; mixing toward white washes it out, and `#042f2e` stops reading as
196
+ teal at all. The steps also have to be *visible*, and a WCAG ratio cannot see
197
+ them — near black, every pair compresses to about 1.0 — so the three dark depths
198
+ are separated in CIELAB `L*`: blue's land at 2.3, 4.5 and 8.6, which is the range
199
+ the shipped neutral dark palette already occupies (`#09090b` at 2.5, `#18181b` at
200
+ 8.4).
201
+ - **The plate keeps its own stop.** `primaryBg` still comes from the wash stop the
202
+ family was measured against, and on a light page that is now also the panel. A
203
+ selected row inside a panel is therefore the same color as its container, exactly
204
+ as it is in the neutral palette, where `#f4f4f5` sits on `#fafafa` at 1.05 — the
205
+ one place a tinted theme buys its tint by spending a layer.
206
+
207
+ An accent registered as a bare pair of hexes has no lightness to walk, so it paints
208
+ brand only: `{ surfaces: true }` is accepted and ignored, and the surfaces keep the
209
+ palette's own values.
210
+
211
+ The choice rides in one stored string — `"teal"` for a brand, `"teal+surfaces"`
212
+ for a theme — which is why `getAccent()` and `getAccentSurfaces()` answer together.
213
+ A bare id is what every app wrote before surfaces existed, so it still parses; and
214
+ a picker needs both answers, because the family already on screen means two
215
+ different things and moving between them is a repaint, not a no-op.
216
+
83
217
  ## Examples
84
218
 
85
219
  ### Everyday example
@@ -131,6 +265,7 @@ runApp(ThemeProvider({ children: ThemedApp() }), "root");
131
265
  - [Device & environment](device.md) — previous chapter.
132
266
  - [Markdown, code & HTML](markdown.md) — next chapter.
133
267
  - [Colors and utilities guide](../guides/utilities.md) — palette walkthrough.
268
+ - [ThemePicker](../widget/ThemePicker.md) — the swatch grid that calls `setAccent`.
134
269
 
135
270
  ---
136
271
 
@@ -26,12 +26,14 @@ const faq = Accordion({
26
26
  | `title` | `string \| Widget` | Title text shown in the header. |
27
27
  | `children` | `Widget` | An array of child widgets. Alias: `child` for a single child. |
28
28
  | `expanded` | `boolean` | The `expanded` value for the widget. |
29
- | `onToggle` | `(expanded: boolean) => void` | Fired with the new toggled state. |
29
+ | `onToggle` | `(expanded: boolean) => void` | Deprecated alias of `onPress`. |
30
+ | `onPress` | `(expanded: boolean) => void` | Called with the new expanded state (`true` or `false`). |
30
31
  | `variant` | `'contained' \| 'outlined' \| 'ghost'` | Visual variation or style preset. |
31
32
  | `borderRadius` | `number` | Rounds the corners of the widget. |
32
33
  | `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
33
34
  | `expandedColor` | `Color` | Color used for the expanded. |
34
35
  | `titleColor` | `Color` | Color used for the title. |
36
+ | `dividerColor` | `Color` | Color used for the divider. |
35
37
  | `titleSize` | `number` | Size of the title. |
36
38
  | `titleWeight` | `string` | The `titleWeight` value for the widget. |
37
39
  | `titlePadding` | `string` | Padding for the title. |
@@ -52,11 +54,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
52
54
 
53
55
  | Prop | Type | Description |
54
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. |
55
74
  | `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
56
75
  | `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
57
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. |
58
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`. |
59
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`. |
60
115
  | `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
61
116
  | `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
62
117
  | `color` | `Color` | Foreground color, usually the text or icon color. |
@@ -66,11 +121,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
66
121
  | `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
67
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. |
68
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. |
69
128
  | `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
70
129
  | `visible` | `boolean` | Whether the widget is rendered and visible. |
71
130
  | `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
72
- | `onPress` | `(widget: Widget) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
73
- | `onClick` | `(widget: Widget) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
131
+ | `onPress` | `(event?: Event) => void` | Called with the new expanded state (`true` or `false`). |
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. |
74
141
  | `id` | `string` | DOM `id` for the rendered element. |
75
142
  | `className` | `string` | CSS class names applied to the rendered element. |
76
143
  | `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
@@ -86,7 +153,7 @@ import { Accordion, Text } from "flet-box";
86
153
  const faq = Accordion({
87
154
  title: "Shipping options",
88
155
  expanded: false,
89
- onToggle: (expanded) => console.log(expanded),
156
+ onPress: (expanded) => console.log(expanded),
90
157
  children: Text({ text: "Free shipping over $50." }),
91
158
  });
92
159
  ```
@@ -112,7 +179,7 @@ const faq = Accordion({
112
179
  divider: true,
113
180
  animate: true,
114
181
  animationDuration: 250,
115
- onToggle: (expanded) => console.log(expanded),
182
+ onPress: (expanded) => console.log(expanded),
116
183
  children: Text({ text: "We accept cards, PayPal, and bank transfer." }),
117
184
  });
118
185
  ```
@@ -128,10 +195,9 @@ const faq = Accordion({
128
195
 
129
196
  ## Behavior
130
197
 
131
- - onToggle receives the new expanded boolean whenever the header is activated.
198
+ - onPress receives the new expanded boolean whenever the header is activated.
132
199
  - disabled blocks toggling, and animate: false skips the open/close transition.
133
- - A shut panel still shows its edge: the header keeps the divider and the
134
- - 'contained' variant paints the raised plate, so it never reads as plain text.
200
+ - A shut panel still shows its edge: the header keeps the divider and the 'contained' variant paints the raised plate, so it never reads as plain text.
135
201
 
136
202
  ## Related widgets
137
203
 
@@ -26,7 +26,7 @@ const banner = AdMob({
26
26
  | --- | --- | --- |
27
27
  | `adId` | `string` | AdMob ad unit id. |
28
28
  | `isTesting` | `boolean` | Requests test ads instead of live ones. |
29
- | `position` | `'top' \| 'bottom'` | CSS `position` value, or `stack` for centered stacking. |
29
+ | `position` | `'top' \| 'bottom'` | Pins the banner to the top or bottom of the viewport. |
30
30
  | `size` | `string` | Overall size preset or pixel value, depending on the widget. |
31
31
  | `margin` | `number` | Space outside the widget, between it and its neighbors. |
32
32
  | `interstitialId` | `string` | AdMob interstitial ad unit id. |
@@ -51,11 +51,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
51
51
 
52
52
  | Prop | Type | Description |
53
53
  | --- | --- | --- |
54
+ | `full` | `boolean` | Stretches the widget to fill its parent on both axes in stack mode. |
55
+ | `fullHeight` | `boolean` | Stretches the widget to the full height of its parent in stack mode. |
56
+ | `fullWidth` | `boolean` | Stretches the widget to the full width of its parent. |
57
+ | `center` | `boolean` | Centres the widget on both axes in stack mode. |
58
+ | `centerY` | `boolean` | Centres the widget vertically in stack mode. |
59
+ | `centerX` | `boolean` | Centres the widget horizontally in stack mode. |
60
+ | `zIndex` | `number` | Stacking order: a widget with a higher value paints above lower ones. |
61
+ | `z` | `number` | Alias of `zIndex`. |
62
+ | `end` | `Size` | Logical alias of `right`, used by the stack placement shorthands. |
63
+ | `start` | `Size` | Logical alias of `left`, used by the stack placement shorthands. |
64
+ | `inset` | `Size` | Shorthand for the four edge offsets (`top`/`right`/`bottom`/`left`). |
65
+ | `left` | `Size` | Offset from the left edge. A number is pixels; a string uses any CSS unit. |
66
+ | `bottom` | `Size` | Offset from the bottom edge. A number is pixels; a string uses any CSS unit. |
67
+ | `right` | `Size` | Offset from the right edge. A number is pixels; a string uses any CSS unit. |
68
+ | `top` | `Size` | Offset from the top edge. A number is pixels; a string uses any CSS unit. |
69
+ | `pos` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Alias of `position`. |
70
+ | `position` | `'static' \| 'relative' \| 'absolute' \| 'fixed' \| 'sticky' \| 'stack'` | Pins the banner to the top or bottom of the viewport. |
54
71
  | `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
55
72
  | `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
56
73
  | `size` | `Size` | Overall size preset or pixel value, depending on the widget. |
74
+ | `flex` | `number` | Flex grow/shrink/basis shorthand for a flex child. |
75
+ | `minWidth` | `Size` | Minimum width the widget may shrink to. |
76
+ | `maxWidth` | `Size` | Maximum width the widget may grow to. |
77
+ | `minHeight` | `Size` | Minimum height the widget may shrink to. |
78
+ | `maxHeight` | `Size` | Maximum height the widget may grow to. |
79
+ | `border` | `string` | CSS `border` shorthand for all four edges: width, style and color in one string. |
80
+ | `borderTop` | `string` | The top edge of the border alone, for a widget whose rim differs per side. |
81
+ | `borderBottom` | `string` | The bottom edge of the border alone, for a widget whose rim differs per side. |
82
+ | `borderLeft` | `string` | The left edge of the border alone, for a widget whose rim differs per side. |
83
+ | `borderRight` | `string` | The right edge of the border alone, for a widget whose rim differs per side. |
84
+ | `cursor` | `string` | CSS `cursor` value: what the pointer becomes over the widget (`pointer`, `grab`, `not-allowed`). |
85
+ | `display` | `string` | CSS `display` value for the container. |
86
+ | `boxSizing` | `'border-box' \| 'content-box'` | Which box `width` and `height` measure: `border-box` keeps the size you asked for and pushes padding inward. |
87
+ | `flexDirection` | `'row' \| 'column' \| 'row-reverse' \| 'column-reverse'` | Main axis of a flex container: `row` places children side by side, `column` stacks them. |
88
+ | `flexGrow` | `number` | Share of the leftover space this child takes, relative to its siblings. |
89
+ | `flexShrink` | `number` | How readily the child gives space back when the row overflows; `0` keeps its size. |
90
+ | `gap` | `number \| string` | Space between children along the layout axis. |
91
+ | `fontSize` | `number` | Size of the font. |
92
+ | `borderColor` | `Color` | Color used for the border. |
93
+ | `borderWidth` | `number` | Width of the border. |
57
94
  | `padding` | `Padding` | Space inside the widget, between its content and its border. |
95
+ | `paddingTop` | `Size` | Space inside the widget, on the top edge only. |
96
+ | `paddingRight` | `Size` | Space inside the widget, on the right edge only. |
97
+ | `paddingBottom` | `Size` | Space inside the widget, on the bottom edge only. |
98
+ | `paddingLeft` | `Size` | Space inside the widget, on the left edge only. |
99
+ | `pt` | `Size` | Alias of `paddingTop`. |
100
+ | `pr` | `Size` | Alias of `paddingRight`. |
101
+ | `pb` | `Size` | Alias of `paddingBottom`. |
102
+ | `pl` | `Size` | Alias of `paddingLeft`. |
58
103
  | `margin` | `Margin` | Space outside the widget, between it and its neighbors. |
104
+ | `marginTop` | `Size` | Space outside the widget, on the top edge only. |
105
+ | `marginRight` | `Size` | Space outside the widget, on the right edge only. |
106
+ | `marginBottom` | `Size` | Space outside the widget, on the bottom edge only. |
107
+ | `marginLeft` | `Size` | Space outside the widget, on the left edge only. |
108
+ | `mt` | `Size` | Alias of `marginTop`. |
109
+ | `mr` | `Size` | Alias of `marginRight`. |
110
+ | `mb` | `Size` | Alias of `marginBottom`. |
111
+ | `ml` | `Size` | Alias of `marginLeft`. |
59
112
  | `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
60
113
  | `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
61
114
  | `color` | `Color` | Foreground color, usually the text or icon color. |
@@ -65,11 +118,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
65
118
  | `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
66
119
  | `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. |
67
120
  | `maskImage` | `string` | Raw CSS `mask-image` value, used to fade a widget out at its edges instead of cutting it. |
121
+ | `bgImage` | `string` | Image painted behind the widget's content (CSS `background-image`), placed with `bgSize` and `bgPosition`. |
122
+ | `bgSize` | `string` | How the background image fills its box (`cover`, `contain`, or a length). |
123
+ | `bgPosition` | `string` | Where the background image is anchored (`center`, `top`, `50% 20%`). |
124
+ | `bgRepeat` | `string` | Whether the background image tiles; `no-repeat` for a single cover. |
68
125
  | `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
69
126
  | `visible` | `boolean` | Whether the widget is rendered and visible. |
70
127
  | `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
71
- | `onPress` | `(widget: Widget) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
72
- | `onClick` | `(widget: Widget) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
128
+ | `onPress` | `(event?: Event) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
129
+ | `onClick` | `(event?: Event) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
130
+ | `onclick` | `(event?: Event) => void` | Lowercase alias of `onClick`, kept because the shipped templates and the HTML habit write it. |
131
+ | `alignSelf` | `AlignSelf` | Overrides the parent's `alignItems` for this child alone (CSS `align-self`). Alias: `selfAlign`. |
132
+ | `selfAlign` | `AlignSelf` | Alias of `alignSelf`. |
133
+ | `overflow` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | How overflowing content is handled (`hidden`, `auto`, `scroll`). |
134
+ | `overflowX` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowX` value for the widget. |
135
+ | `overflowY` | `'auto' \| 'hidden' \| 'visible' \| 'scroll' \| 'clip'` | The `overflowY` value for the widget. |
136
+ | `textOverflow` | `'clip' \| 'ellipsis' \| string` | The `textOverflow` value for the widget. |
137
+ | `whiteSpace` | `'normal' \| 'nowrap' \| 'pre' \| 'pre-wrap' \| 'pre-line' \| string` | The `whiteSpace` value for the widget. |
73
138
  | `id` | `string` | DOM `id` for the rendered element. |
74
139
  | `className` | `string` | CSS class names applied to the rendered element. |
75
140
  | `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
@@ -45,11 +45,64 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
45
45
 
46
46
  | Prop | Type | Description |
47
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. |
48
65
  | `width` | `Size` | Width of the widget. A number is pixels; a string uses any CSS unit. |
49
66
  | `height` | `Size` | Height of the widget. A number is pixels; a string uses any CSS unit. |
50
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. |
51
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`. |
52
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`. |
53
106
  | `bgColor` | `Color` | Background color. Alias: `backgroundColor`. |
54
107
  | `backgroundColor` | `Color` | Background color. Alias of `bgColor`. |
55
108
  | `color` | `Color` | Foreground color, usually the text or icon color. |
@@ -59,11 +112,23 @@ Every widget also accepts these shared props — see [common props](COMMON_PROPS
59
112
  | `filter` | `string` | Raw CSS `filter` value applied to the widget itself, e.g. `blur(4px)`. |
60
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. |
61
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. |
62
119
  | `opacity` | `number` | Opacity from 0 (invisible) to 1 (fully opaque). |
63
120
  | `visible` | `boolean` | Whether the widget is rendered and visible. |
64
121
  | `disabled` | `boolean` | Disables interaction and shows the non-interactive state. |
65
- | `onPress` | `(widget: Widget) => void` | Callback fired when the widget is pressed. Alias: `onClick`. |
66
- | `onClick` | `(widget: Widget) => void` | Callback fired when the widget is clicked. Alias: `onPress`. |
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. |
67
132
  | `id` | `string` | DOM `id` for the rendered element. |
68
133
  | `className` | `string` | CSS class names applied to the rendered element. |
69
134
  | `ref` | `(widget: Widget) => void` | Callback that receives the underlying DOM node. |
@@ -100,4 +100,4 @@ const alert = AlertDialog({
100
100
  - **Next:** [Modal](Modal.md)
101
101
  - **Index:** [Widget index](README.md) · [Start here](START_HERE.md)
102
102
 
103
- You are reading **Chapter 4 · Feedback and overlays** (1 of 10).
103
+ You are reading **Chapter 4 · Feedback and overlays** (1 of 11).