moxule-components 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +1167 -2
- package/dist/THIRD_PARTY_NOTICES.txt +2637 -0
- package/dist/index.cjs +5176 -0
- package/dist/index.css +4955 -0
- package/dist/index.d.cts +899 -0
- package/dist/index.d.ts +899 -0
- package/dist/index.js +5100 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,1168 @@
|
|
|
1
|
-
#
|
|
1
|
+
# moxule-components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A TypeScript React component library with themed controls, Markdown editing,
|
|
4
|
+
calendars, and drawing tools.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install moxule-components
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
React and React DOM (18 or newer) are peer dependencies. Import the stylesheet
|
|
13
|
+
once in your application entry point:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button, ThemeProvider } from 'moxule-components';
|
|
17
|
+
import 'moxule-components/styles.css';
|
|
18
|
+
|
|
19
|
+
export function Example() {
|
|
20
|
+
return <ThemeProvider theme="purple" mode="light"><Button>Hello</Button></ThemeProvider>;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Published packages contain built JavaScript, TypeScript declarations, styles,
|
|
25
|
+
and license notices; consumers do not need a sibling checkout or build tools.
|
|
26
|
+
`npm pack` and `npm publish` build these files through the `prepack` hook.
|
|
27
|
+
The npm package can be public while the source repository stays private.
|
|
28
|
+
|
|
29
|
+
## Scripts
|
|
30
|
+
|
|
31
|
+
- `npm run dev`: Build in watch mode
|
|
32
|
+
- `npm run demo`: Run Vite sample page locally
|
|
33
|
+
- `npm run demo:build`: Build Vite sample page
|
|
34
|
+
- `npm run demo:preview`: Preview built Vite sample page
|
|
35
|
+
- `npm run build`: Build ESM and CJS bundles with type declarations
|
|
36
|
+
- `npm run typecheck`: Run TypeScript checks
|
|
37
|
+
- `npm test`: Run tests once
|
|
38
|
+
|
|
39
|
+
## Demo routing and pages
|
|
40
|
+
|
|
41
|
+
The static demo is deployed with `.github/workflows/deploy-demo.yml` on pushes
|
|
42
|
+
to `main` or manual workflow dispatch. Repository Settings → Pages must use
|
|
43
|
+
**GitHub Actions** as its source. The workflow obtains the Pages base path,
|
|
44
|
+
checks types/tests, builds, and deploys only `demo-dist`.
|
|
45
|
+
|
|
46
|
+
The project URL is https://m-ox.github.io/moxule-components/.
|
|
47
|
+
Production routes use hashes, for example `/#/form-components`, so direct links
|
|
48
|
+
and refreshes work on static hosting. Local development retains browser routes.
|
|
49
|
+
`npm run demo:build -- --base /moxule-components/` reproduces the project build;
|
|
50
|
+
`npm run demo:preview` serves it locally. Library builds remain in `dist`, so
|
|
51
|
+
building the demo no longer replaces the package's distributable files.
|
|
52
|
+
|
|
53
|
+
The navbar has one avatar menu for component pages and Preferences. Dashboard
|
|
54
|
+
remains the landing page and is accessible through the navbar logo.
|
|
55
|
+
Light/dark mode is available in Preferences. Press Ctrl+K (Windows/Linux) or
|
|
56
|
+
Command+K (Mac) to toggle the menu. The shortcut leaves text fields and modal
|
|
57
|
+
dialogs alone; Escape closes the menu and returns focus to the avatar.
|
|
58
|
+
|
|
59
|
+
`/` is a lean directory of component groups:
|
|
60
|
+
|
|
61
|
+
| Page | Examples |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `/creative-components` | Font styles, theme selection, ColorPicker, Avatar, AvatarGroup, Badge, LinkPreview |
|
|
64
|
+
| `/form-components` | Text/password/currency inputs, TextArea, Combobox, multi-select, Slider, choices, and a complete form |
|
|
65
|
+
| `/interaction-components` | Drawer, Modal, Popover, Accordion, DropdownMenu, Tabs |
|
|
66
|
+
| `/calendar-components` | Calendar month grid, daily agenda, and DateTime with time-zone controls |
|
|
67
|
+
| `/feedback-components` | Nudge, Banner, LoadingIndicator |
|
|
68
|
+
| `/layout-components` | Spacer and the linked app sitemap |
|
|
69
|
+
| `/writing-components` | Markdown editor, preview, save, download, and FileUpload attachments |
|
|
70
|
+
|
|
71
|
+
Preferences stays a compact settings form. `/fonts` and `/themes` redirect to
|
|
72
|
+
Creative's respective sections, `/components` redirects to Form Components,
|
|
73
|
+
and legacy home section anchors route to the relevant group. Query strings and
|
|
74
|
+
anchors are preserved. The menu and sitemap share the canonical route list.
|
|
75
|
+
|
|
76
|
+
The demo selects React Router's `BrowserRouter` for local development and
|
|
77
|
+
`HashRouter` for production in `src/demo/main.tsx`.
|
|
78
|
+
`App` composes `DemoProvider` and `NavRouter`. Dashboard is the home page at `/`.
|
|
79
|
+
Older `/dashboard` URLs redirect home, preserving query strings and section
|
|
80
|
+
anchors; unknown URLs show a page with a link back to Dashboard.
|
|
81
|
+
|
|
82
|
+
`src/demo/navigation/NavRouter.tsx` owns route definitions and their
|
|
83
|
+
`handle.breadcrumb` labels. `navigation/pages.ts` holds the canonical page list
|
|
84
|
+
shared by the router, dashboard, menu, and sitemap.
|
|
85
|
+
It supplies the matching breadcrumb trail to `AppLayout`, which displays it
|
|
86
|
+
above the page content in the sticky header area, just below the navbar.
|
|
87
|
+
Breadcrumbs span the header width and align with the navbar logo's left inset.
|
|
88
|
+
The footer remains in normal page flow.
|
|
89
|
+
Add new page routes and their breadcrumb labels in `NavRouter`.
|
|
90
|
+
The trail follows matched route ancestry: Dashboard shows a single current-page
|
|
91
|
+
marker, and nested pages add their actual parent steps.
|
|
92
|
+
|
|
93
|
+
Each dashboard card opens its group, including Writing Components. Group pages
|
|
94
|
+
have a Dashboard → group breadcrumb trail and are linked from the menu.
|
|
95
|
+
|
|
96
|
+
The menu also opens `/preferences`: one compact card for font style, theme color,
|
|
97
|
+
text size, and light/dark mode. Appearance choices are validated and stored in
|
|
98
|
+
`sessionStorage`, surviving navigation and reloads for the current tab's session.
|
|
99
|
+
The app continues working when browser storage is unavailable.
|
|
100
|
+
|
|
101
|
+
`pages/Dashboard/DashboardPage.tsx` renders the category links. Each group owns its
|
|
102
|
+
page; creative preview sections live under `pages/CreativeComponents/sections`,
|
|
103
|
+
and reusable demos live under `components/examples`. Shared theme, mode, font,
|
|
104
|
+
size, and density preferences live in `DemoProvider` and survive navigation;
|
|
105
|
+
local example state stays with its example. Footer links open group pages.
|
|
106
|
+
Demo images and favicons live in `src/demo/assets`, and demo styles live in
|
|
107
|
+
`src/demo/styles/styles.css`.
|
|
108
|
+
|
|
109
|
+
## Quick start
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
npm install
|
|
113
|
+
npm run build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## GitHub dependency consumers
|
|
117
|
+
|
|
118
|
+
This repository commits its library build output in `dist/` so private projects
|
|
119
|
+
that install from GitHub can resolve package exports without an extra publish
|
|
120
|
+
step.
|
|
121
|
+
|
|
122
|
+
When source changes affect the library bundle or declarations:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
npm run build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Commit the updated `dist/` files in the same change.
|
|
129
|
+
|
|
130
|
+
## First component
|
|
131
|
+
|
|
132
|
+
`Button` is exported from the package root:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import { Button } from "moxule-components";
|
|
136
|
+
import "moxule-components/styles.css";
|
|
137
|
+
|
|
138
|
+
export function Example() {
|
|
139
|
+
return <Button variant="primary">Click me</Button>;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Theming
|
|
144
|
+
|
|
145
|
+
Import `moxule-components/styles.css` once in your app entry point. Default component styles, theme palettes, and font variants are provided by CSS classes and data attributes. Custom palettes and `customTokens` emit only their differences as a scoped CSS rule inside the provider; they no longer fill the wrapper’s `style` attribute. Rules update with props, remain isolated between providers, and are included in server-rendered markup. Explicit `sx`/`style` overrides still take precedence. Theme CSS is generated from the TypeScript token definitions by `npm run styles:generate`, and is regenerated by the library and demo build commands.
|
|
146
|
+
|
|
147
|
+
The Vite demo also regenerates theme CSS when palette, CSS-variable mapping, or font definitions change, so the preview updates without restarting the server.
|
|
148
|
+
|
|
149
|
+
Use `ThemeProvider` to control color mode (`light` or `dark`) and theme flavor (`primary`, `secondary`, `tertiary`, `blue`, `red`, `green`, `purple`, or `pink`).
|
|
150
|
+
|
|
151
|
+
Font styling presets are also available:
|
|
152
|
+
|
|
153
|
+
- `fontStyle="clear"` -> Gudea (default)
|
|
154
|
+
- `fontStyle="playful"` -> Quicksand, a rounded sans serif
|
|
155
|
+
- `fontStyle="stark"` -> IBM Plex Mono, a monospace
|
|
156
|
+
- `fontStyle="bizarre"` -> Fraunces, a soft serif
|
|
157
|
+
|
|
158
|
+
Each choice applies one family to headings, body text, and controls with normal
|
|
159
|
+
letter spacing. Clear/Gudea is the default in both the library and demo. Saved
|
|
160
|
+
font choices retain the Clear, Playful, Stark, and Bizarre names.
|
|
161
|
+
Load the chosen font in your application; the demo loads all four through Google Fonts.
|
|
162
|
+
|
|
163
|
+
Typography uses the CSS variable `--mx-font-scale` (default `1`). The demo's Size dropdown sets Small to `0.875`, Medium to `1`, and Large to `1.125`, scaling headings, body text, controls, labels, and footer text together. This leaves spacing under the separate density setting and preserves browser font preferences.
|
|
164
|
+
|
|
165
|
+
Many components also accept semantic `color` values (for example `primary`, `secondary`, `tertiary`, `blue`, `red`, `green`, `purple`, `pink`) so you can apply a specific theme palette per component.
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
import { Button, ThemeProvider } from "moxule-components";
|
|
169
|
+
|
|
170
|
+
export function Example() {
|
|
171
|
+
return (
|
|
172
|
+
<ThemeProvider mode="dark" theme="secondary">
|
|
173
|
+
<Button variant="primary">Primary action</Button>
|
|
174
|
+
<Button variant="secondary">Secondary action</Button>
|
|
175
|
+
<Button variant="ghost">Ghost action</Button>
|
|
176
|
+
</ThemeProvider>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
You can also override individual tokens for a custom brand theme:
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<ThemeProvider
|
|
185
|
+
mode="light"
|
|
186
|
+
theme="primary"
|
|
187
|
+
customTokens={{
|
|
188
|
+
buttonPrimaryBg: "#0057ff",
|
|
189
|
+
buttonPrimaryText: "#ffffff",
|
|
190
|
+
fontDisplay: '"Inter", sans-serif',
|
|
191
|
+
fontBody: '"Source Sans 3", sans-serif'
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
<Button>Custom brand button</Button>
|
|
195
|
+
</ThemeProvider>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Navbar
|
|
199
|
+
|
|
200
|
+
Use `Navbar` when you need a reusable app header with a left logo and right-side wrapped actions.
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { Navbar } from "moxule-components";
|
|
204
|
+
|
|
205
|
+
function Logo() {
|
|
206
|
+
return <strong>Moxule</strong>;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function LogOutButton() {
|
|
210
|
+
return <button type="button">Log out</button>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function UserMenu() {
|
|
214
|
+
return <button type="button">User menu</button>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function Example() {
|
|
218
|
+
return (
|
|
219
|
+
<Navbar left={<Logo />} right={<><LogOutButton /><UserMenu /></>} />
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Dark-mode fields use separate `controlBg`, `controlBgHover`, and `controlText`
|
|
225
|
+
theme tokens (`--mx-control-bg`, `--mx-control-bg-hover`, `--mx-control-text`).
|
|
226
|
+
Generated dark palettes keep resting controls at least 3:1 against their card
|
|
227
|
+
surface and control text at least 4.5:1 against resting/hover fills. Light-mode
|
|
228
|
+
fields use the component palette's soft fill; dropdowns, text inputs and combobox
|
|
229
|
+
shells share this treatment. Selected chips use primary button fill/text. Accent
|
|
230
|
+
colors identify selection markers, focus-related emphasis and headings.
|
|
231
|
+
Explicit custom token overrides are
|
|
232
|
+
app-owned and can change those ratios.
|
|
233
|
+
|
|
234
|
+
## Footer
|
|
235
|
+
|
|
236
|
+
Use `Footer` for bottom page navigation/actions with either centered content or evenly split sections.
|
|
237
|
+
|
|
238
|
+
- `position="natural"` keeps footer in normal document flow (good for long pages).
|
|
239
|
+
- `position="static"` fixes footer to the viewport bottom.
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { Footer, Link } from "moxule-components";
|
|
243
|
+
|
|
244
|
+
export function FooterExamples() {
|
|
245
|
+
return (
|
|
246
|
+
<>
|
|
247
|
+
<Footer layout="centered" position="static">
|
|
248
|
+
<Link href="#about" color="inherit">About</Link>
|
|
249
|
+
<Link href="#terms" color="inherit">Terms</Link>
|
|
250
|
+
<Link href="#privacy" color="inherit">Privacy</Link>
|
|
251
|
+
</Footer>
|
|
252
|
+
|
|
253
|
+
<Footer layout="split" position="natural">
|
|
254
|
+
<span>Column one</span>
|
|
255
|
+
<span>Column two</span>
|
|
256
|
+
<span>Column three</span>
|
|
257
|
+
</Footer>
|
|
258
|
+
</>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Toggle
|
|
264
|
+
|
|
265
|
+
Use `Toggle` as a reusable switch control with a classic sliding bubble.
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { useState } from "react";
|
|
269
|
+
import { Toggle } from "moxule-components";
|
|
270
|
+
|
|
271
|
+
function SoundSwitch() {
|
|
272
|
+
const [checked, setChecked] = useState(false);
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<Toggle
|
|
276
|
+
checked={checked}
|
|
277
|
+
onCheckedChange={setChecked}
|
|
278
|
+
label="Enable sound"
|
|
279
|
+
/>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Visible toggle labels are clickable and supply the accessible name. The demo's Toggle card includes an independent sound switch and a disabled example.
|
|
285
|
+
|
|
286
|
+
## ThemeToggle
|
|
287
|
+
|
|
288
|
+
Use `ThemeToggle` in a `Navbar` for a reusable light/dark switch with sun and moon icons. Light mode uses a warm amber track, and dark mode uses a deep navy track with a pale moon thumb. These colors stay recognizable across theme palettes. It reads the current mode from `ThemeProvider` and sends the next mode to `onModeChange`.
|
|
289
|
+
|
|
290
|
+
```tsx
|
|
291
|
+
import { useState } from "react";
|
|
292
|
+
import { ThemeProvider, ThemeToggle, Navbar, type ThemeMode } from "moxule-components";
|
|
293
|
+
|
|
294
|
+
function App() {
|
|
295
|
+
const [mode, setMode] = useState<ThemeMode>("light");
|
|
296
|
+
return (
|
|
297
|
+
<ThemeProvider mode={mode}>
|
|
298
|
+
<Navbar left={<strong>App</strong>} right={<ThemeToggle onModeChange={setMode} />} />
|
|
299
|
+
</ThemeProvider>
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Pass `mode` explicitly when using it outside a provider. `label`, `labelPosition`, `ariaLabel`, `disabled`, native button props, and class/style overrides are supported. The checked state represents dark mode. The parent owns mode state, and the default focus outline inherits the surrounding text color for visibility on navbar backgrounds.
|
|
305
|
+
|
|
306
|
+
## Section
|
|
307
|
+
|
|
308
|
+
Use `Section` to group a heading, description, and related content. It renders the semantic section, `Header`, and `Text`, and automatically connects their accessible labels and descriptions.
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
import { Button, Section } from "moxule-components";
|
|
312
|
+
|
|
313
|
+
<Section
|
|
314
|
+
title="Account settings"
|
|
315
|
+
description="Manage your account preferences."
|
|
316
|
+
headingLevel="h2"
|
|
317
|
+
>
|
|
318
|
+
<Button>Save preferences</Button>
|
|
319
|
+
</Section>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`title` and `description` are optional React content. `headingLevel` defaults to `h2`; select the level that fits the surrounding page hierarchy. `headingProps` and `descriptionProps` customize their typography, IDs, and classes. Native section attributes, a section `ref`, and `sx`/`style` overrides are supported. Default styles inherit the current theme and font scale; `--mx-section-gap` controls the default `0.75rem` gap.
|
|
323
|
+
|
|
324
|
+
## Card
|
|
325
|
+
|
|
326
|
+
Use `Card` for reusable surface items tied to the theme. Light themes use clean white cards against the tinted page background; dark themes retain their dark surfaces. Cards have no borders, decorative outlines, or shadows by default. `appearance="none"` and the legacy `appearance="outline"` provide a transparent container. Set `borderColors` to opt into a thin border: one color is solid, and multiple colors blend diagonally between opposite corners. This adds no layout space and keeps the shared rounded corners.
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
import { Card, Header, Text } from "moxule-components";
|
|
330
|
+
|
|
331
|
+
export function ExampleCard() {
|
|
332
|
+
return (
|
|
333
|
+
<Card>
|
|
334
|
+
<Header variant="h4">Card title</Header>
|
|
335
|
+
<Text variant="sm" sx={{ marginTop: "0.5rem" }}>
|
|
336
|
+
Card body content.
|
|
337
|
+
</Text>
|
|
338
|
+
</Card>
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```tsx
|
|
344
|
+
<Card borderColors={["#7553ad", "#479c85"]}>
|
|
345
|
+
<Text>A card whose border reflects its metadata colors.</Text>
|
|
346
|
+
</Card>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Link
|
|
350
|
+
|
|
351
|
+
`Link` renders a themed anchor with a shared animated underline and a rounded,
|
|
352
|
+
visible focus outline. Use `color="inherit"` on footer or Navbar backgrounds.
|
|
353
|
+
Text keeps its resting color on hover and keyboard focus; an accent underline
|
|
354
|
+
provides emphasis. The default `underline="hover"` reveals a thin underline
|
|
355
|
+
gently on hover or focus in dashboard cards, footers, and other containers.
|
|
356
|
+
Use `underline="always"` for links inside sentences and Markdown.
|
|
357
|
+
The underline shade adjusts to the chrome
|
|
358
|
+
background. Motion respects reduced-motion preferences, and keyboard focus keeps
|
|
359
|
+
its rounded ring. Custom surfaces can set `--mx-link-hover-color` for the underline.
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import { Link } from "moxule-components";
|
|
363
|
+
import { Link as RouterLink, NavLink } from "react-router-dom";
|
|
364
|
+
|
|
365
|
+
<Link href="https://example.com">Documentation</Link>
|
|
366
|
+
|
|
367
|
+
<Link asChild>
|
|
368
|
+
<RouterLink to="/settings">Settings</RouterLink>
|
|
369
|
+
</Link>
|
|
370
|
+
|
|
371
|
+
<Link asChild>
|
|
372
|
+
<NavLink to="/reports" className={({ isActive }) => isActive ? "active" : undefined}>
|
|
373
|
+
Reports
|
|
374
|
+
</NavLink>
|
|
375
|
+
</Link>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
`asChild` applies styling to one child link without adding another anchor. Put routing props such as `to`, `state`, and `replace` on the child and render it within your router. React Router is not a runtime dependency of this library. The wrapper preserves child refs, event handlers, and [NavLink render callbacks](https://reactrouter.com/api/components/NavLink) for class names, styles, and content.
|
|
379
|
+
|
|
380
|
+
Native anchor props, `class`/`className`, `sx`/`style`, and an anchor `ref` are supported. With `asChild`, the child must forward those props to its anchor. Classes are combined; child props and styles take precedence. Child handlers run first, and preventing default skips the corresponding wrapper handler. A wrapper handler can also prevent navigation.
|
|
381
|
+
|
|
382
|
+
## Image
|
|
383
|
+
|
|
384
|
+
Use `Image` for consistent image rendering with library prop conventions.
|
|
385
|
+
|
|
386
|
+
If loading fails or no source is provided, `Image` renders a circular span with the uppercased first character of its trimmed `alt` text. The fallback retains the full accessible name, classes, explicit dimensions, and style overrides; decorative images remain hidden from assistive technology. `onError` still receives the original image error event. Changing `src`, `srcSet`, or `sizes` retries loading automatically, so consuming components do not need their own failure state.
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
import { Image } from "moxule-components";
|
|
390
|
+
|
|
391
|
+
export function Logo() {
|
|
392
|
+
return (
|
|
393
|
+
<Image
|
|
394
|
+
src="/favicon.png"
|
|
395
|
+
alt="Brand logo"
|
|
396
|
+
width={32}
|
|
397
|
+
height={32}
|
|
398
|
+
sx={{ borderRadius: "999px", objectFit: "cover" }}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## Calendar
|
|
405
|
+
|
|
406
|
+
`Calendar` provides a themed, full-width month grid. Clicking a date with events
|
|
407
|
+
opens that day's agenda in a small Modal, with full titles, times, descriptions
|
|
408
|
+
and optional event actions. The agenda starts closed and reserves no sidebar.
|
|
409
|
+
Native Enter/Space activates a date; arrow keys only move focus. Close, Escape or
|
|
410
|
+
backdrop click dismiss the dialog and restore focus. Set `showAgenda={false}` to
|
|
411
|
+
retain date selection without the dialog. Modal handles reduced motion and exits.
|
|
412
|
+
Calendar & Dates includes a working example.
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
<Calendar defaultValue="2026-12-02" events={[
|
|
416
|
+
{ id: "review", date: "2026-12-02", title: "Design review", time: "10:00 AM", color: "purple" }
|
|
417
|
+
]} onChange={setSelectedDate} onEventClick={openEvent} />
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Use `value`/`onChange` for controlled dates and `month`/`onMonthChange` for
|
|
421
|
+
controlled month navigation. Dates use local `YYYY-MM-DD` keys; months use
|
|
422
|
+
`YYYY-MM`. `locale`, `weekStartsOn={1}` and `showAgenda={false}` customize display.
|
|
423
|
+
The app supplies event data and handles provider authentication/synchronization,
|
|
424
|
+
time-zone conversion, recurrence and editing. No Google connection is built in.
|
|
425
|
+
|
|
426
|
+
`Calendar.daySummaries` accepts a map such as `{ "2026-12-03": "9 notes" }`.
|
|
427
|
+
These context labels remain visible in compact cells, are included in accessible
|
|
428
|
+
date names, and stay separate from event counts. Aggregation belongs to the app.
|
|
429
|
+
For a shorter compact-cell label, use `{ label: "9 notes", compactLabel: "9" }`
|
|
430
|
+
as the date's value. `compactLabel` also accepts a ReactNode for an icon and count.
|
|
431
|
+
The full label remains available to assistive technology. In compact containers,
|
|
432
|
+
summary badges occupy their own row, events use up to three colored dots, and
|
|
433
|
+
date cells keep a uniform height. Click the date for full event details.
|
|
434
|
+
|
|
435
|
+
## Checklist and LinkPreview
|
|
436
|
+
|
|
437
|
+
`Checklist` builds on Checkbox with a native fieldset, completion progress,
|
|
438
|
+
controlled `value` or local `defaultValue`, and `onChange(completedIds)`.
|
|
439
|
+
`name`, `form`, native submission/reset, disabled items and disabled groups are
|
|
440
|
+
supported. Items use unique `{ id, label, disabled? }` records. See Forms.
|
|
441
|
+
|
|
442
|
+
```tsx
|
|
443
|
+
<Checklist legend="Shopping" items={items} defaultValue={["eggs"]} />
|
|
444
|
+
<LinkPreview href="https://maudlinoxalis.xyz/" title="m-ox | Home"
|
|
445
|
+
description="Portfolio of Maud Nordby" />
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
`LinkPreview` accepts `title`, `description`, `siteName`, `imageSrc` and `imageAlt`.
|
|
449
|
+
It is one native HTTP(S) link, with hostname fallback and graceful image failure.
|
|
450
|
+
The app supplies metadata, typically from a server-side preview service; this
|
|
451
|
+
component does not fetch arbitrary websites in the browser. Creative includes
|
|
452
|
+
the supplied portfolio URL with its public Open Graph title, description and image.
|
|
453
|
+
|
|
454
|
+
## Badge
|
|
455
|
+
|
|
456
|
+
`Badge` is a compact, informational label with a soft solid fill and the shared
|
|
457
|
+
8px radius. `color` accepts any theme palette or a three/six-digit hex color.
|
|
458
|
+
Colors follow light/dark mode, including custom hex colors. Omit `color` to use
|
|
459
|
+
the surrounding palette. Invalid colors fall back to that palette.
|
|
460
|
+
|
|
461
|
+
```tsx
|
|
462
|
+
<Badge color="green">Published</Badge>
|
|
463
|
+
<Badge color="purple">Design</Badge>
|
|
464
|
+
<Badge color="#c97b98">Custom color</Badge>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Native span props, a span ref, `class`/`className`, and `sx`/`style` are supported.
|
|
468
|
+
Use `--mx-badge-bg` and `--mx-badge-text` for explicit fill/text overrides. Badges
|
|
469
|
+
inherit shared typography and font scaling. They have no implicit button or live
|
|
470
|
+
region behavior; add native ARIA props when needed. Examples live in Creative.
|
|
471
|
+
|
|
472
|
+
## Avatar and AvatarGroup
|
|
473
|
+
|
|
474
|
+
`Avatar` shares the UserMenu's circular style, with photos, initials, and a person
|
|
475
|
+
icon fallback. `name` supplies the accessible name and automatic initials; photo
|
|
476
|
+
failures keep that name and fall back without changing the outer element.
|
|
477
|
+
Explicit `initials` or `icon` customize the fallback. `imageProps` accepts native
|
|
478
|
+
image events, loading, responsive sources, and crop styling. Changing the image
|
|
479
|
+
source retries loading. Set `decorative` when an adjacent name or containing
|
|
480
|
+
button/link already identifies the person.
|
|
481
|
+
|
|
482
|
+
```tsx
|
|
483
|
+
<Avatar name="Alex Brooks" src="/alex.png" size="lg" />
|
|
484
|
+
<Avatar name="Jordan Diaz" color="purple" />
|
|
485
|
+
<Avatar aria-label="Guest avatar" />
|
|
486
|
+
|
|
487
|
+
<AvatarGroup aria-label="Project contributors" max={3} items={people} />
|
|
488
|
+
<UserMenu label="Alex's menu" avatar={{ name: "Alex Brooks", src: "/alex.png" }} items={actions} />
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Avatar sizes `xs`, `sm`, `md`, `lg`, and `xl` are 24, 32, 44, 56, and 72px before
|
|
492
|
+
font scaling. The default is `md`, matching UserMenu. Theme-aware fills stay flat
|
|
493
|
+
and borderless. `color` selects a palette; `sx`/`style` and `--mx-avatar-bg`,
|
|
494
|
+
`--mx-avatar-text`, `--mx-avatar-bg-hover` provide explicit overrides.
|
|
495
|
+
|
|
496
|
+
`AvatarGroup` takes items with unique `id`, `name`, and optional Avatar props.
|
|
497
|
+
It shows up to `max` people (default 4), followed by a separate **+N** button.
|
|
498
|
+
Open it to see the remaining names and photos in a keyboard-accessible popover;
|
|
499
|
+
Escape closes and restores focus. Set `overlap={false}` for spaced circles.
|
|
500
|
+
The first person stays in front of the overlap; put the primary person first.
|
|
501
|
+
`size` and `color` apply to the group; item colors can override its default.
|
|
502
|
+
Empty groups render nothing. Both components have examples in Creative Components.
|
|
503
|
+
|
|
504
|
+
Button minimum heights follow the size scale: `xs` 28px, `sm` 36px, `md` 44px, `lg` 48px, and `xl` 52px. Use the default `md` button alongside a Dropdown for matching 44px controls. Labels can still expand controls when text is scaled.
|
|
505
|
+
|
|
506
|
+
## Dropdown
|
|
507
|
+
|
|
508
|
+
Use `Dropdown` for selecting from a list of options. It has a borderless fill and a visible focus ring when focused.
|
|
509
|
+
|
|
510
|
+
Dropdowns share the control fill, hover fill and text tokens used by text inputs
|
|
511
|
+
and comboboxes, including when a dropdown has no FormField wrapper. Explicit
|
|
512
|
+
styles and field CSS variable overrides remain available.
|
|
513
|
+
|
|
514
|
+
```tsx
|
|
515
|
+
import { Dropdown } from "moxule-components";
|
|
516
|
+
|
|
517
|
+
const options = [
|
|
518
|
+
{ label: "Blue", value: "blue" },
|
|
519
|
+
{ label: "Primary", value: "primary" }
|
|
520
|
+
];
|
|
521
|
+
|
|
522
|
+
export function ThemePicker() {
|
|
523
|
+
const [theme, setTheme] = useState("blue");
|
|
524
|
+
|
|
525
|
+
return (
|
|
526
|
+
<>
|
|
527
|
+
<label htmlFor="theme-picker">Theme</label>
|
|
528
|
+
<Dropdown
|
|
529
|
+
id="theme-picker"
|
|
530
|
+
options={options}
|
|
531
|
+
value={theme}
|
|
532
|
+
onChange={setTheme}
|
|
533
|
+
/>
|
|
534
|
+
</>
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
## RadioGroup and CheckboxGroup
|
|
540
|
+
|
|
541
|
+
Use `RadioGroup` for a list of mutually exclusive options. It renders the fieldset, legend, optional description, and labelled native radio inputs. Pass `options` as `{ label, value, disabled? }` objects with unique values. Use `value` and `onChange(value)` for controlled selection, or `defaultValue` for native uncontrolled selection and form reset. A shared `name` is generated if omitted; supply it explicitly for form submission. `disabled` disables the group, and `required` enables native validation. Fieldset attributes, a fieldset `ref`, and `sx`/`style` overrides are supported.
|
|
542
|
+
|
|
543
|
+
`Radio` remains available for custom layouts. `Radio` and `Checkbox` accept a required visible `label`, native input props, and an input `ref`.
|
|
544
|
+
|
|
545
|
+
Use `CheckboxGroup` for multiple selections with component-owned spacing. It owns the fieldset, legend, description, and option list, with a default `0.75rem` vertical gap. Set `--mx-checkbox-group-gap` in CSS to customize spacing. Its `value`/`defaultValue` are arrays, and `onChange` receives the selected values. Options accept `{ label, value, disabled?, required? }`; `required` applies to an individual checkbox.
|
|
546
|
+
|
|
547
|
+
```tsx
|
|
548
|
+
import { useState } from "react";
|
|
549
|
+
import { CheckboxGroup, RadioGroup } from "moxule-components";
|
|
550
|
+
|
|
551
|
+
export function Preferences() {
|
|
552
|
+
const [density, setDensity] = useState("comfortable");
|
|
553
|
+
const [notifications, setNotifications] = useState<string[]>([]);
|
|
554
|
+
|
|
555
|
+
return (
|
|
556
|
+
<>
|
|
557
|
+
<RadioGroup
|
|
558
|
+
name="density"
|
|
559
|
+
legend="Display density"
|
|
560
|
+
description="Choose the preview spacing."
|
|
561
|
+
options={[
|
|
562
|
+
{ label: "Comfortable", value: "comfortable" },
|
|
563
|
+
{ label: "Compact", value: "compact" }
|
|
564
|
+
]}
|
|
565
|
+
value={density}
|
|
566
|
+
onChange={setDensity}
|
|
567
|
+
/>
|
|
568
|
+
<CheckboxGroup
|
|
569
|
+
legend="Notifications"
|
|
570
|
+
name="notifications"
|
|
571
|
+
options={[
|
|
572
|
+
{ label: "Email", value: "email" },
|
|
573
|
+
{ label: "SMS", value: "sms" }
|
|
574
|
+
]}
|
|
575
|
+
value={notifications}
|
|
576
|
+
onChange={setNotifications}
|
|
577
|
+
/>
|
|
578
|
+
</>
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
## Accessible controls
|
|
584
|
+
|
|
585
|
+
Buttons gain a subtle themed tint while pressed and fade back gently on release.
|
|
586
|
+
This uses native pressed states, supports pointer and keyboard interaction,
|
|
587
|
+
leaves disabled buttons unchanged, and respects reduced-motion preferences.
|
|
588
|
+
|
|
589
|
+
Form Components includes text/password/currency inputs, textareas, file queues,
|
|
590
|
+
searchable single/multi-selects, sliders, buttons, choices, toggles, and a complete
|
|
591
|
+
form. The Comfortable and Compact radio options change preview spacing and card
|
|
592
|
+
padding. Controls inherit theme colors and fonts, with visible focus outlines
|
|
593
|
+
and keyboard behavior. Native selects, radios, and checkboxes retain browser
|
|
594
|
+
semantics and respect the provider's color scheme.
|
|
595
|
+
|
|
596
|
+
Provide a meaningful button name and a visible label for each `Dropdown`, using
|
|
597
|
+
its `label` prop or an external `<label htmlFor="...">`. `RadioGroup` supplies a
|
|
598
|
+
shared `name`, a `<fieldset>`, and a `<legend>`. Keep interactive content outside
|
|
599
|
+
radio and checkbox labels.
|
|
600
|
+
|
|
601
|
+
Tests cover accessible names, descriptions, focus, disabled behavior, selection, form validation and submission, and default theme text contrast of at least 4.5:1. Custom token overrides and style overrides need their own contrast checks. These components support the [Section 508 WCAG AA requirements](https://www.section508.gov/test/websites/); full application conformance also requires manual keyboard, screen reader, and forced colors testing.
|
|
602
|
+
|
|
603
|
+
Buttons use their theme's primary, secondary, or ghost hover colors, including explicit per-button theme colors. Dropdowns gain a soft themed fill on hover, and radio and checkbox hit areas gain a matching tint. Disabled controls keep their resting appearance, focus rings remain visible, and the transitions respect reduced-motion preferences.
|
|
604
|
+
|
|
605
|
+
## TextInput
|
|
606
|
+
|
|
607
|
+
`TextInput` provides a visible label, optional description/error, native input
|
|
608
|
+
props, controlled or uncontrolled values, and an input ref.
|
|
609
|
+
|
|
610
|
+
```tsx
|
|
611
|
+
<TextInput label="Title" name="title" defaultValue="A little story" />
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Form Components includes the text, textarea, file, password, numeric, and currency
|
|
615
|
+
examples. Writing Components contains the Markdown editor. Older `/blog-components`
|
|
616
|
+
links redirect to `/writing-components`.
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
<TextInput label="Password" type="password" passwordToggle />
|
|
620
|
+
<TextInput label="Search" search clearable placeholder="Find something…" />
|
|
621
|
+
<TextInput label="Budget" name="budget" dataType="currency" currency="USD"
|
|
622
|
+
locale="en-US" value={budget} onValueChange={setBudget} clearable />
|
|
623
|
+
<TextInput label="Quantity" name="quantity" dataType="integer"
|
|
624
|
+
defaultValue={1} min={0} max={20} step={1} stepper suffix="items" />
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
`dataType="integer" | "decimal" | "currency"` preserves editable drafts while
|
|
628
|
+
focused and formats on blur using `Intl.NumberFormat`. `onValueChange` receives
|
|
629
|
+
a number or null; `onChange` retains its native display-text event. Named numeric
|
|
630
|
+
inputs submit a canonical numeric string and honor native validity, min/max/step,
|
|
631
|
+
disabled state, and form reset. Currency rounds to its displayed precision on blur.
|
|
632
|
+
`prefix`, `suffix`, `clearable`, and `passwordToggle` are optional accessories.
|
|
633
|
+
|
|
634
|
+
## Form fields and complete forms
|
|
635
|
+
|
|
636
|
+
Use `Form compact` and `FormGrid` for compact layouts without per-demo CSS:
|
|
637
|
+
|
|
638
|
+
```tsx
|
|
639
|
+
<Form compact onSubmit={handleSubmit}>
|
|
640
|
+
<FormGrid columns={2}>
|
|
641
|
+
<TextInput label="Name" name="name" required />
|
|
642
|
+
<TextInput label="Email" name="email" type="email" required />
|
|
643
|
+
</FormGrid>
|
|
644
|
+
<Button type="submit">Save</Button>
|
|
645
|
+
</Form>
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
Compact mode tightens label/row spacing without reserved error rows, while keeping
|
|
649
|
+
normal control sizes and focus indicators. Invalid fields show a focusable circled
|
|
650
|
+
exclamation inside the control; hover or focus reveals its validation message,
|
|
651
|
+
and Escape dismisses it. Errors stay linked to inputs and announced to screen
|
|
652
|
+
readers. Set `errorDisplay="inline"` on Form to show messages below fields instead.
|
|
653
|
+
FormGrid uses a native fieldset, aligns controls at the top, and reduces columns
|
|
654
|
+
based on its own available width. Native form submission, reset, and fieldset
|
|
655
|
+
disabled behavior are preserved. The Complete form example uses this layout.
|
|
656
|
+
|
|
657
|
+
`FormField` shares associated labels, required markers, descriptions, errors, and
|
|
658
|
+
reserved feedback space across the input components. It can wrap custom controls:
|
|
659
|
+
|
|
660
|
+
```tsx
|
|
661
|
+
<FormField label="Reference" required error={error} reserveErrorSpace>
|
|
662
|
+
{(control) => <input {...control} name="reference" />}
|
|
663
|
+
</FormField>
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Dropdown now accepts `label`, `description`, `error`, and `reserveErrorSpace`.
|
|
667
|
+
RadioGroup and CheckboxGroup retain native fieldsets/legends and share the error
|
|
668
|
+
feedback. Named Toggle controls participate in FormData; unchecked/disabled
|
|
669
|
+
switches are excluded. Uncontrolled switches restore `defaultChecked` on reset.
|
|
670
|
+
`Button loading loadingLabel="Saving…"` disables repeated actions and marks the
|
|
671
|
+
pending state without hiding its accessible name.
|
|
672
|
+
|
|
673
|
+
The Complete form example demonstrates an error summary with focus links,
|
|
674
|
+
first-error focus, required and numeric validation, pending submission, a simulated
|
|
675
|
+
server error, canonical FormData values, and cancellation/reset. All data stays in
|
|
676
|
+
the example; applications provide their own validation and submission services.
|
|
677
|
+
|
|
678
|
+
## Searchable and multiple selection
|
|
679
|
+
|
|
680
|
+
```tsx
|
|
681
|
+
<Combobox label="Region" name="region" options={regions} required />
|
|
682
|
+
<Combobox label="Topics" name="topics" options={topics} multiple
|
|
683
|
+
value={selectedTopics} onChange={setSelectedTopics} />
|
|
684
|
+
<Slider label="Volume" name="volume" min={0} max={100} step={5}
|
|
685
|
+
defaultValue={40} formatValue={(value) => `${value}%`} />
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
Combobox filters labels, skips disabled choices, and keeps keyboard focus in the
|
|
689
|
+
input while Arrow keys, Home/End, and Enter navigate/select options. Escape and
|
|
690
|
+
outside focus/pointer dismiss the popup. Multi-select adds removable chips and
|
|
691
|
+
submits repeated named values through `FormData.getAll`. Required validation
|
|
692
|
+
checks committed choices rather than unselected search text. Slider uses a native
|
|
693
|
+
range input and announces its formatted value.
|
|
694
|
+
|
|
695
|
+
FileUpload supports `showFileList`, `maxFiles`, `maxFileSize`, `validateFile`,
|
|
696
|
+
`onFilesReject`, and supplied `progress`. Removal keeps the native FileList in sync
|
|
697
|
+
in browsers with DataTransfer support; uploading remains application-owned.
|
|
698
|
+
|
|
699
|
+
## Markdown editor
|
|
700
|
+
|
|
701
|
+
`MarkdownEditor` edits and saves plain Markdown. The Writing Components page has
|
|
702
|
+
a full-width example whose Save action persists the post in `localStorage`;
|
|
703
|
+
Download exports it as a `.md` file.
|
|
704
|
+
|
|
705
|
+
```tsx
|
|
706
|
+
const [markdown, setMarkdown] = useState("# My post\n\nA little story.");
|
|
707
|
+
|
|
708
|
+
<MarkdownEditor
|
|
709
|
+
label="Post content"
|
|
710
|
+
value={markdown}
|
|
711
|
+
onChange={setMarkdown}
|
|
712
|
+
onSave={(source) => savePost(source)}
|
|
713
|
+
downloadFileName="my-post.md"
|
|
714
|
+
/>
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
`onSave` receives the exact Markdown string and can return a promise. The library
|
|
718
|
+
leaves persistence to the consuming app. Failed saves retain the draft and allow
|
|
719
|
+
retrying; editing while saving preserves the newer unsaved changes. Without
|
|
720
|
+
`onSave`, the editor still supports editing, preview, and download. Set
|
|
721
|
+
`downloadFileName={false}` to hide Download. `defaultValue` supports uncontrolled
|
|
722
|
+
use, and `textareaProps` forwards native form/validation attributes.
|
|
723
|
+
|
|
724
|
+
The compact toolbar keeps Bold/Italic visible and groups other actions into
|
|
725
|
+
Format, List, and Insert dropdowns. Undo/Redo includes typing and formatting.
|
|
726
|
+
Tooltips explain controls on hover and focus. Ctrl/Command+B, I, and K format;
|
|
727
|
+
Z undoes, Shift+Z or Y redoes, and S saves. Write/Preview preserves source.
|
|
728
|
+
|
|
729
|
+
`Markdown` separately renders a string as children. It uses `react-markdown` with
|
|
730
|
+
`remark-gfm` for CommonMark, tables, task lists, and strikethrough. Raw HTML is
|
|
731
|
+
skipped, the renderer's URL filtering remains enabled, and images use the
|
|
732
|
+
library's fallback behavior. The renderer is bundled into both ESM and CommonJS
|
|
733
|
+
outputs; dependency notices ship in `dist/THIRD_PARTY_NOTICES.txt`.
|
|
734
|
+
|
|
735
|
+
## Tooltip
|
|
736
|
+
|
|
737
|
+
`Tooltip` adds airy, themed help to one focusable element or component that
|
|
738
|
+
forwards `aria-describedby`.
|
|
739
|
+
|
|
740
|
+
```tsx
|
|
741
|
+
<Tooltip content="Save the current Markdown draft.">
|
|
742
|
+
<Button onClick={save}>Save</Button>
|
|
743
|
+
</Tooltip>
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
Hover opens after 250ms; keyboard focus opens immediately. Escape dismisses
|
|
747
|
+
without moving focus. Existing descriptions and handlers are preserved, and
|
|
748
|
+
the pointer can move onto the tooltip. `side="top"`/`"bottom"`, `delay`, and
|
|
749
|
+
`disabled` customize behavior. The borderless fill fades gently in/out and
|
|
750
|
+
respects reduced motion. Allow overflow around the inline wrapper.
|
|
751
|
+
|
|
752
|
+
## Modal
|
|
753
|
+
|
|
754
|
+
`Modal` is a centered, controlled dialog with the same keyboard, focus, scroll
|
|
755
|
+
locking, and dismissal behavior as Drawer. It has a flat themed surface and a
|
|
756
|
+
delicate 240ms fade with a small vertical movement, respecting reduced motion.
|
|
757
|
+
|
|
758
|
+
```tsx
|
|
759
|
+
<Modal
|
|
760
|
+
title="Confirm changes"
|
|
761
|
+
description="Review before continuing."
|
|
762
|
+
open={open}
|
|
763
|
+
onOpenChange={setOpen}
|
|
764
|
+
size="md"
|
|
765
|
+
footer={<Button onClick={() => setOpen(false)}>Continue</Button>}
|
|
766
|
+
>
|
|
767
|
+
<Text>Your changes are ready.</Text>
|
|
768
|
+
</Modal>
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
Sizes are `sm` (24rem), `md` (32rem), and `lg` (44rem), constrained to the viewport.
|
|
772
|
+
`footer` accepts action content. `closeOnEscape`, `closeOnBackdrop`, `closeLabel`,
|
|
773
|
+
`initialFocusRef`, `onDismiss`, native dialog props, and style overrides are supported.
|
|
774
|
+
Keep the component mounted while setting `open={false}` so its exit can finish.
|
|
775
|
+
|
|
776
|
+
The shared corner scale is consistent across themes and light/dark modes:
|
|
777
|
+
|
|
778
|
+
| Use | CSS variable | Default |
|
|
779
|
+
| --- | --- | --- |
|
|
780
|
+
| Checkbox markers, inline code, text focus | `--mx-detail-radius` | 4px |
|
|
781
|
+
| Embedded actions, menu options, tooltips | `--mx-inset-radius` | 8px |
|
|
782
|
+
| Buttons, text inputs, selects, file pickers, tab strips | `--mx-control-radius` | 12px |
|
|
783
|
+
| Cards, dialogs, popovers, notifications | `--mx-panel-radius` | 20px |
|
|
784
|
+
|
|
785
|
+
Corners are uniformly rounded. Circles, avatar buttons, slider thumbs, chips, and
|
|
786
|
+
pill switches keep their circular or pill shapes. Joined surfaces share the
|
|
787
|
+
outer silhouette; drawers keep the edge against the viewport square. Override
|
|
788
|
+
these variables with CSS on your theme wrapper. Compound inputs show one focus
|
|
789
|
+
ring on the active target: the field when editing, or its embedded action when
|
|
790
|
+
that button has keyboard focus.
|
|
791
|
+
The Modal example card follows Drawer in Interaction Components.
|
|
792
|
+
|
|
793
|
+
## Drawer and MenuButton
|
|
794
|
+
|
|
795
|
+
`Drawer` is a controlled modal panel with `side="left"` or `side="right"`
|
|
796
|
+
(default right). It uses the native dialog top layer to contain focus and make
|
|
797
|
+
the background inactive. It inherits theme colors and fonts, with a flat,
|
|
798
|
+
borderless surface and a soft 240ms slide/fade.
|
|
799
|
+
|
|
800
|
+
```tsx
|
|
801
|
+
import { useId, useState } from "react";
|
|
802
|
+
import { Drawer, MenuButton } from "moxule-components";
|
|
803
|
+
|
|
804
|
+
function Navigation() {
|
|
805
|
+
const [open, setOpen] = useState(false);
|
|
806
|
+
const id = useId();
|
|
807
|
+
return <>
|
|
808
|
+
<MenuButton open={open} aria-controls={id} onClick={() => setOpen(true)} />
|
|
809
|
+
<Drawer id={id} title="Menu" side="left" open={open} onOpenChange={setOpen}>
|
|
810
|
+
Navigation content
|
|
811
|
+
</Drawer>
|
|
812
|
+
</>;
|
|
813
|
+
}
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
`title` supplies the accessible name; optional `description` is automatically
|
|
817
|
+
associated. The close button, Escape, and backdrop request closing through
|
|
818
|
+
`onOpenChange(false)`. Set `closeOnEscape` or `closeOnBackdrop` to false to disable
|
|
819
|
+
those interactions. Use `initialFocusRef` for an alternate initial focus target
|
|
820
|
+
and `closeLabel` to name the close button. `onDismiss` runs after closing finishes.
|
|
821
|
+
|
|
822
|
+
Keep the Drawer mounted while changing `open`. It locks page scrolling until
|
|
823
|
+
the exit finishes, restores focus to the opener, cancels pending exits when
|
|
824
|
+
reopened, and cleans up on unmount. Reduced motion skips the animation.
|
|
825
|
+
Set `--mx-drawer-width` in CSS to customize the default 22rem width.
|
|
826
|
+
|
|
827
|
+
The Drawer card in Interaction Components lets you try either side.
|
|
828
|
+
The demo navbar uses a single UserMenu dropdown for page navigation.
|
|
829
|
+
|
|
830
|
+
## Nudges and notifications
|
|
831
|
+
|
|
832
|
+
Wrap the app with `NudgeProvider` inside `ThemeProvider`, then call `useNudges()`
|
|
833
|
+
from any descendant. Nudges stack in the bottom-right corner by default and
|
|
834
|
+
share Banner's status colors, custom accent support, and flat surface.
|
|
835
|
+
|
|
836
|
+
```tsx
|
|
837
|
+
import { NudgeProvider, ThemeProvider, useNudges, Button } from "moxule-components";
|
|
838
|
+
|
|
839
|
+
function SaveExample() {
|
|
840
|
+
const { nudge } = useNudges();
|
|
841
|
+
return <Button onClick={() => nudge({ message: "Saved!", variant: "success" })}>Save</Button>;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
<ThemeProvider>
|
|
845
|
+
<NudgeProvider position="bottom-right">
|
|
846
|
+
<SaveExample />
|
|
847
|
+
</NudgeProvider>
|
|
848
|
+
</ThemeProvider>
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
Variants are `success`, `warning`, `error`, and `neutral`; `color` accepts any CSS
|
|
852
|
+
accent color. `nudge("Message")` is a neutral shortcut. Each call returns an ID
|
|
853
|
+
for `dismiss(id)`; `dismissAll()` clears the stack with the same gentle animation.
|
|
854
|
+
`Nudge` is also exported for standalone use.
|
|
855
|
+
|
|
856
|
+
Non-error nudges close after six seconds by default. Errors stay until closed;
|
|
857
|
+
set `duration: 0` to keep any message visible, or supply a duration in milliseconds.
|
|
858
|
+
The provider's `duration` changes the default for non-errors. Timers pause on
|
|
859
|
+
hover and keyboard focus. Each nudge has a close X, announces its message without
|
|
860
|
+
taking focus, and respects reduced-motion preferences. `onDismiss` runs after the
|
|
861
|
+
240ms exit animation. Pending timers are cancelled on unmount.
|
|
862
|
+
|
|
863
|
+
The provider supports all four corner positions, inherits theme/font changes,
|
|
864
|
+
and scrolls for long queues. The demo's Notifications card follows Toggle and
|
|
865
|
+
lets you trigger each status, the current theme color, and custom-color examples.
|
|
866
|
+
|
|
867
|
+
## Breadcrumbs
|
|
868
|
+
|
|
869
|
+
`Sitemap` provides a clickable overview using the same outlined/filled nodes
|
|
870
|
+
and thin, rounded connections. Pass `items` as `{ label, href, children? }`
|
|
871
|
+
objects, `currentPath` to highlight the current page, and optional `renderLink`
|
|
872
|
+
for router links. Every node remains clickable. The demo shares its canonical
|
|
873
|
+
page list between router, user menu, and sitemap, and includes an App paths
|
|
874
|
+
example on `/layout-components`.
|
|
875
|
+
|
|
876
|
+
`Breadcrumbs` renders an accessible ordered navigation trail using themed
|
|
877
|
+
`Link` components. Pass `items` from root to current page. The last item is
|
|
878
|
+
plain text with `aria-current="page"`. Parent pages have outlined circles and the
|
|
879
|
+
current page has a filled circle. A thin line runs above the trail, drops down
|
|
880
|
+
to ancestor nodes, and slopes down to the current node. Lines adapt when text
|
|
881
|
+
or viewport sizes change, with separate rails for wrapped rows and no horizontal
|
|
882
|
+
scroller. Markers and lines use the theme accent and are decorative. Empty
|
|
883
|
+
trails render nothing; a single page has no connecting line. Customize the
|
|
884
|
+
navigation name with `aria-label`, or supply `separator` for custom inline
|
|
885
|
+
separators in place of the rail.
|
|
886
|
+
|
|
887
|
+
```tsx
|
|
888
|
+
<Breadcrumbs items={[
|
|
889
|
+
{ label: "Home", href: "/" },
|
|
890
|
+
{ label: "Dashboard" }
|
|
891
|
+
]} />
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
For React Router, supply `renderLink`. It is only called for ancestor items
|
|
895
|
+
with an `href`, and its returned link receives the library's styling via
|
|
896
|
+
`Link asChild`. React Router remains an optional integration for the library.
|
|
897
|
+
|
|
898
|
+
```tsx
|
|
899
|
+
import { Link as RouterLink } from "react-router-dom";
|
|
900
|
+
import { Breadcrumbs } from "moxule-components";
|
|
901
|
+
|
|
902
|
+
<Breadcrumbs
|
|
903
|
+
items={[{ label: "Home", href: "/" }, { label: "Dashboard" }]}
|
|
904
|
+
renderLink={(item) => <RouterLink to={item.href!}>{item.label}</RouterLink>}
|
|
905
|
+
/>
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
The demo builds these items from route metadata and places Breadcrumbs at the
|
|
909
|
+
top of the shared app layout, so individual pages don't repeat the trail.
|
|
910
|
+
|
|
911
|
+
## Banner
|
|
912
|
+
|
|
913
|
+
`Banner` displays a `message` with a thick left color strip and a themed card surface.
|
|
914
|
+
Choose `success`, `warning`, `error`, or `neutral` (default), or set a custom accent
|
|
915
|
+
with `color`. The banner and optional close button have no decorative borders or shadows.
|
|
916
|
+
|
|
917
|
+
```tsx
|
|
918
|
+
<Banner variant="success" message="Your changes have been saved." />
|
|
919
|
+
<Banner color="#5f4a89" message="A custom notice." dismissible onDismiss={() => console.log("Dismissed")} />
|
|
920
|
+
```
|
|
921
|
+
|
|
922
|
+
`dismissible` adds a keyboard-accessible close X on the right. Closing gently fades
|
|
923
|
+
and collapses the banner over 240ms, then calls `onDismiss`. Dismissal is immediate
|
|
924
|
+
when the user prefers reduced motion.
|
|
925
|
+
Use `closeLabel` to customize its accessible name. Remount the component to show it
|
|
926
|
+
again after dismissal. The default role is `alert` for errors and `status` otherwise;
|
|
927
|
+
override `role` for static informational content when announcements aren't needed.
|
|
928
|
+
Native div props, a ref, and `sx`/`style` overrides are supported.
|
|
929
|
+
|
|
930
|
+
## PageShell
|
|
931
|
+
|
|
932
|
+
Use `PageShell` for full-page structure with navbar/content/footer. It reserves no footer space by default; set `footerOffset` only when using a fixed footer. PageShell and Layout share a background derived by shifting the primary color's hue by -30 degrees, then applying fixed off-white lightness in light mode or subtle charcoal lightness in dark mode. Purple gets a pale blue backdrop. Hex `customTokens.buttonPrimaryBg` overrides also derive the background automatically unless `customTokens.pageShellBg` is supplied explicitly.
|
|
933
|
+
|
|
934
|
+
```tsx
|
|
935
|
+
import { Footer, Layout, Navbar, PageShell } from "moxule-components";
|
|
936
|
+
|
|
937
|
+
export function ExamplePage() {
|
|
938
|
+
return (
|
|
939
|
+
<PageShell>
|
|
940
|
+
<Navbar left={<div>Brand</div>} />
|
|
941
|
+
<Layout margin="lg" contentWidth="md" style={{ flex: 1 }}>
|
|
942
|
+
Main content
|
|
943
|
+
</Layout>
|
|
944
|
+
<Footer layout="centered" position="natural">
|
|
945
|
+
Footer links
|
|
946
|
+
</Footer>
|
|
947
|
+
</PageShell>
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
## Popover, Accordion, and DropdownMenu
|
|
953
|
+
|
|
954
|
+
Reusable exports are demonstrated on `/interaction-components`. They use theme colors, soft corners, borderless
|
|
955
|
+
surfaces, keyboard focus indicators, and reduced-motion-aware transitions.
|
|
956
|
+
|
|
957
|
+
```tsx
|
|
958
|
+
<Popover label="More details" trigger={<Button>Details</Button>}>
|
|
959
|
+
<Text>A little extra context.</Text>
|
|
960
|
+
</Popover>
|
|
961
|
+
<Accordion items={[
|
|
962
|
+
{ id: "details", title: "More information", content: <Text>The details.</Text> }
|
|
963
|
+
]} />
|
|
964
|
+
<DropdownMenu label="Document actions" trigger={<Button>Actions</Button>}
|
|
965
|
+
items={[{ id: "save", label: "Save", onSelect: saveDocument }]} />
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
Popover and DropdownMenu support `open`/`onOpenChange` or `defaultOpen`, plus
|
|
969
|
+
`align="start" | "end"`. Triggers must forward native button props. Popovers
|
|
970
|
+
focus their first control without trapping Tab; menus include arrow navigation,
|
|
971
|
+
Home/End, typeahead, disabled actions, and focus restoration. Both close on
|
|
972
|
+
Escape or outside interaction. Accordion supports `multiple`, controlled `value`
|
|
973
|
+
and `onValueChange`, and a configurable `headingLevel`.
|
|
974
|
+
|
|
975
|
+
## Tabs, button icons, and loading
|
|
976
|
+
|
|
977
|
+
`Tabs` accepts a named list of views and supports controlled selection, disabled
|
|
978
|
+
items, arrow-key navigation, and automatic or manual activation. Inactive panels
|
|
979
|
+
stay mounted to preserve their state. Interaction Components includes the Tabs demo; Feedback Components shows LoadingIndicator.
|
|
980
|
+
|
|
981
|
+
```tsx
|
|
982
|
+
<Tabs label="Document views" items={[
|
|
983
|
+
{ id: "draft", label: "Draft", content: <Text>Your draft.</Text> },
|
|
984
|
+
{ id: "history", label: "History", content: <Text>Recent changes.</Text> }
|
|
985
|
+
]} />
|
|
986
|
+
<Button icon={<SaveIcon />} iconPosition="start">Save</Button>
|
|
987
|
+
<LoadingIndicator label="Saving your draft…" size="md" />
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
Button accepts any decorative icon element directly. LoadingIndicator shows
|
|
991
|
+
three dots growing and hopping in sequence, with a single accessible status
|
|
992
|
+
message and a static reduced-motion version. Floating surfaces share a soft
|
|
993
|
+
shadow to distinguish them from underlying content: Popover, DropdownMenu,
|
|
994
|
+
UserMenu, Tooltip, Modal, Drawer, and notifications in the Nudge viewport.
|
|
995
|
+
Menus share the same rounded panel shape. The `--mx-overlay-shadow` token adapts
|
|
996
|
+
to light/dark mode and can be customized through `ThemeProvider`'s
|
|
997
|
+
`customTokens.overlayShadow` or a CSS variable override.
|
|
998
|
+
Set `tail` on `UserMenu`, `DropdownMenu`, or `Popover` to try a small curved
|
|
999
|
+
speech-bubble tail. It points toward the trigger and flips with the panel.
|
|
1000
|
+
|
|
1001
|
+
## Spacer
|
|
1002
|
+
|
|
1003
|
+
`Spacer` uses the same spacing unit as the demo's card grids. One unit defaults
|
|
1004
|
+
to `0.75rem`; set `--mx-space-unit` on a layout and use it as the grid `gap` to
|
|
1005
|
+
scale cards and spacers together. Compact demo density updates both.
|
|
1006
|
+
|
|
1007
|
+
```tsx
|
|
1008
|
+
<Spacer /> // one unit vertically
|
|
1009
|
+
<Spacer height={2} /> // two units vertically
|
|
1010
|
+
<Spacer width={0.5} /> // half a unit horizontally
|
|
1011
|
+
<Spacer height={1} width={2} />
|
|
1012
|
+
<Spacer line height={1} /> // horizontal divider in one unit of space
|
|
1013
|
+
<Spacer line width={1} height={2} /> // vertical divider between controls
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
Spacers are decorative, hidden from assistive technology, and resist flex
|
|
1017
|
+
shrinking. The loading example uses spacers around a stable status area so the
|
|
1018
|
+
completed message and button have breathing room without shifting on completion.
|
|
1019
|
+
`line` draws a thin divider using the theme border color; `lineColor` or
|
|
1020
|
+
`--mx-spacer-line-color` overrides its color. UserMenu and DropdownMenu items can
|
|
1021
|
+
set `separatorBefore: true` to use a Spacer line between groups, as shown above
|
|
1022
|
+
Preferences in the navbar user menu. Dividers do not enter the tab or arrow-key order.
|
|
1023
|
+
|
|
1024
|
+
## Card spacing
|
|
1025
|
+
|
|
1026
|
+
Cards automatically stack their direct children with a one-unit gap, using the
|
|
1027
|
+
same `--mx-space-unit` as Spacer and the demo card grids. They grow with content,
|
|
1028
|
+
allow children to fit narrower widths, and keep buttons at their natural width.
|
|
1029
|
+
|
|
1030
|
+
```tsx
|
|
1031
|
+
<Card><Header>Actions</Header><DropdownMenu {...menuProps} /><Text>Feedback</Text></Card>
|
|
1032
|
+
<Card gap={2}>More breathing room between children.</Card>
|
|
1033
|
+
<Card freestyle className="my-custom-grid">Your layout, your spacing.</Card>
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
`gap` accepts fractional or whole unit multipliers. `freestyle` opts out of
|
|
1037
|
+
Card's column, gap, and child sizing entirely. Wrap related controls when they
|
|
1038
|
+
need a separate inner layout. Grouped demo cards use the default gap; the
|
|
1039
|
+
Spacer example explicitly uses freestyle to demonstrate manual spacing.
|
|
1040
|
+
|
|
1041
|
+
## Custom theme colors
|
|
1042
|
+
|
|
1043
|
+
Creative Components and Preferences use one row per palette: a preset dropdown,
|
|
1044
|
+
a color swatch, and Apply. Selecting a preset or using the system color picker
|
|
1045
|
+
stages the choice; Apply commits it. The component, backdrop, and accent rows remain
|
|
1046
|
+
independent, and applied choices persist for the tab's session. There are no
|
|
1047
|
+
duplicate theme cards or standalone hex controls in these settings.
|
|
1048
|
+
|
|
1049
|
+
Library consumers can generate the same palette directly:
|
|
1050
|
+
|
|
1051
|
+
```tsx
|
|
1052
|
+
<ThemeProvider primaryColor="#5f4a89" mode="light">
|
|
1053
|
+
<App />
|
|
1054
|
+
</ThemeProvider>
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
`primaryColor` derives surfaces, text, chrome, hover states, and the page
|
|
1058
|
+
background in either mode. `customTokens` can override individual derived tokens.
|
|
1059
|
+
`normalizeHexColor(value)` validates/expands input; `deriveThemeFromColor(hex, mode)`
|
|
1060
|
+
returns the generated tokens and rejects invalid colors. Preset themes continue
|
|
1061
|
+
to use generated CSS; custom colors apply runtime CSS variables.
|
|
1062
|
+
|
|
1063
|
+
## Form errors
|
|
1064
|
+
|
|
1065
|
+
Form controls accept an `error` prop and render a shared
|
|
1066
|
+
FieldError surface. They mark the control invalid and link the announced message
|
|
1067
|
+
through `aria-describedby`, preserving other hints. Clear `error` once resolved.
|
|
1068
|
+
|
|
1069
|
+
```tsx
|
|
1070
|
+
<TextInput label="Theme hex" value={value} onChange={handleChange}
|
|
1071
|
+
error={error} />
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
`FieldError` is also exported for custom fields: give it an id and associate the
|
|
1075
|
+
field using `aria-describedby` and `aria-invalid`. Validation logic belongs to
|
|
1076
|
+
the form. The standalone ColorPicker example in Creative Components demonstrates
|
|
1077
|
+
hex validation without adding extra controls to theme settings.
|
|
1078
|
+
Invalid `ThemeProvider.primaryColor` values fall back to the selected preset;
|
|
1079
|
+
the lower-level `deriveThemeFromColor` helper still rejects malformed input.
|
|
1080
|
+
|
|
1081
|
+
Use `reserveErrorSpace` on TextInput, TextArea, or FileUpload when validation
|
|
1082
|
+
should not shift nearby content. It reserves two lines of feedback; longer errors
|
|
1083
|
+
can still grow naturally. Invalid fields receive a muted red border, preserving
|
|
1084
|
+
their normal fill and keyboard focus ring. Error messages are plain text using
|
|
1085
|
+
`--mx-validation-color` with light/dark defaults, separate from notification colors.
|
|
1086
|
+
Reserve feedback space only in forms that need it; theme settings use compact
|
|
1087
|
+
preset/swatch/Apply rows.
|
|
1088
|
+
|
|
1089
|
+
## ColorPicker
|
|
1090
|
+
|
|
1091
|
+
ColorPicker combines the existing TextInput with a native color swatch. Clicking
|
|
1092
|
+
or keyboard-activating the swatch opens the system color chooser. The custom
|
|
1093
|
+
theme rows use its swatch-only mode; Form Components has a standalone example.
|
|
1094
|
+
|
|
1095
|
+
```tsx
|
|
1096
|
+
<ColorPicker label="Accent color" value={color} onChange={setColor}
|
|
1097
|
+
error={error} />
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
Use `defaultValue` for uncontrolled selection. `onChange` receives raw text drafts
|
|
1101
|
+
or six-digit hex values from the picker; validate with `normalizeHexColor` before
|
|
1102
|
+
applying them. Incomplete drafts preserve the last valid swatch. Supports shared
|
|
1103
|
+
field hints/errors, disabled/read-only states, native form names, and a ref to
|
|
1104
|
+
the hex input. The picker selects opaque RGB colors; OS dialog styling varies.
|
|
1105
|
+
|
|
1106
|
+
## Independent backdrop and component palettes
|
|
1107
|
+
|
|
1108
|
+
ThemeProvider can split the app backdrop from its foreground pieces:
|
|
1109
|
+
|
|
1110
|
+
```tsx
|
|
1111
|
+
<ThemeProvider
|
|
1112
|
+
theme="purple"
|
|
1113
|
+
primaryColor="#5f4a89"
|
|
1114
|
+
backdropTheme="green"
|
|
1115
|
+
backdropColor="#0f7d72"
|
|
1116
|
+
mode="light"
|
|
1117
|
+
>
|
|
1118
|
+
<App />
|
|
1119
|
+
</ThemeProvider>
|
|
1120
|
+
```
|
|
1121
|
+
|
|
1122
|
+
- `theme` / `primaryColor` choose the component palette: cards, controls, body
|
|
1123
|
+
text, and component inset surfaces.
|
|
1124
|
+
- `backdropTheme` / `backdropColor` independently choose the page background,
|
|
1125
|
+
navbar, and footer. Custom hex values take precedence over the role's preset.
|
|
1126
|
+
- Without backdrop props, the provider retains its original single-palette
|
|
1127
|
+
behavior. `customTokens` remains the final override for individual tokens.
|
|
1128
|
+
- Both roles follow `mode`. The Accent palette defaults to Tertiary and is independently configurable.
|
|
1129
|
+
|
|
1130
|
+
Creative Components and Preferences expose all three roles and remember them for the
|
|
1131
|
+
session. Each row stages its preset or custom color and commits it with Apply.
|
|
1132
|
+
Existing sessions initialize both roles from their previous single selection.
|
|
1133
|
+
`--mx-control-bg` / `controlBg` keep inset component fills independent from
|
|
1134
|
+
`--mx-page-shell-bg` / `pageShellBg`.
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
## Accent palette
|
|
1138
|
+
|
|
1139
|
+
`accentTheme` defaults to `"tertiary"`; `accentColor` optionally supplies a custom
|
|
1140
|
+
hex accent. Creative Components and Preferences expose the same preset/swatch/
|
|
1141
|
+
Apply row as the other roles, with session persistence.
|
|
1142
|
+
|
|
1143
|
+
```tsx
|
|
1144
|
+
<ThemeProvider theme="purple" backdropTheme="green" accentTheme="pink">
|
|
1145
|
+
<App />
|
|
1146
|
+
</ThemeProvider>
|
|
1147
|
+
```
|
|
1148
|
+
|
|
1149
|
+
Accents cover default headings and link interaction colors, checkbox/radio selections, Toggle
|
|
1150
|
+
thumbs, accordion interiors, active loading dots, breadcrumb/sitemap
|
|
1151
|
+
nodes. Explicit per-element
|
|
1152
|
+
color overrides still win. The day/night toggle retains its semantic sun/moon
|
|
1153
|
+
track colors, with accent-colored thumbs. Validation/status colors remain separate.
|
|
1154
|
+
|
|
1155
|
+
The palette derives readable text and marker shades plus a soft surface tint.
|
|
1156
|
+
Toolbar/footer link shades adjust separately against the chrome background.
|
|
1157
|
+
|
|
1158
|
+
Calendar highlights Saturday and Sunday with a subtle muted fill by default. Use `highlightWeekends={false}` to disable it or override `--mx-calendar-weekend-bg` and `--mx-calendar-weekend-hover-bg`. Selection keeps its primary fill; outside-month days stay quiet.
|
|
1159
|
+
|
|
1160
|
+
## Drawing
|
|
1161
|
+
|
|
1162
|
+
`Drawing` provides a responsive canvas with an icon-only pencil/eraser, size slider, and color/background pickers in its bottom toolbar. It supports pointer and keyboard drawing. Use controlled `value`/`onChange` or `defaultValue` to keep the editable document. A `DrawingHandle` ref exposes `await ref.current.toBlob()` to export a PNG bitmap; the consumer owns saving/uploading. Default bitmap dimensions are 960×600; `width`, `height`, and `disabled` are supported. The Writing Components demo includes a working PNG export.
|
|
1163
|
+
|
|
1164
|
+
MarkdownEditor supports optional `textAlign="left" | "center"` and `onTextAlignChange` for whole-document presentation controls. Alignment is reported separately and never inserts HTML or rewrites Markdown.
|
|
1165
|
+
|
|
1166
|
+
On small screens Drawing wraps its tools, size slider and color controls into
|
|
1167
|
+
separate rows. The Scroll canvas hand tool allows vertical touch scrolling over
|
|
1168
|
+
the canvas without adding strokes; choose Pencil or Erase to resume drawing.
|