@diegopluna/narvi 0.3.5 → 0.3.7
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/dist/components/app-shell/AppShellPanel.svelte +37 -11
- package/dist/components/app-shell/AppShellPanel.svelte.d.ts +13 -0
- package/dist/components/button/Button.svelte +24 -5
- package/dist/components/button/Button.svelte.d.ts +13 -1
- package/dist/components/command/CommandDialog.svelte +9 -2
- package/dist/components/command/CommandDialog.svelte.d.ts +4 -0
- package/dist/components/command/CommandEmpty.svelte +38 -4
- package/dist/components/command/CommandEmpty.svelte.d.ts +18 -2
- package/dist/components/command/CommandFooter.svelte +5 -7
- package/dist/components/command/CommandFooter.svelte.d.ts +4 -1
- package/dist/components/command/CommandInput.svelte +13 -1
- package/dist/components/command/CommandInput.svelte.d.ts +11 -0
- package/dist/components/command/CommandItem.svelte +32 -6
- package/dist/components/command/CommandItem.svelte.d.ts +20 -0
- package/dist/components/command/CommandRoot.svelte +68 -9
- package/dist/components/command/CommandRoot.svelte.d.ts +13 -3
- package/dist/components/command/styles.d.ts +50 -8
- package/dist/components/command/styles.js +50 -8
- package/dist/components/menu/MenuContent.svelte +7 -1
- package/dist/components/menu/MenuContent.svelte.d.ts +10 -0
- package/dist/components/queued-message/QueuedMessage.svelte +3 -2
- package/dist/components/rail/RailRoot.svelte +3 -3
- package/dist/components/segmented/SegmentedControl.svelte +2 -1
- package/dist/components/settings-row/SettingsRow.svelte +3 -2
- package/dist/components/split-button/SplitButton.svelte +58 -16
- package/dist/components/split-button/SplitButton.svelte.d.ts +22 -5
- package/dist/components/tabs/Tabs.svelte +2 -1
- package/dist/components/tooltip/TooltipProvider.svelte +23 -0
- package/dist/components/tooltip/TooltipProvider.svelte.d.ts +8 -0
- package/dist/components/tooltip/index.d.ts +4 -5
- package/dist/components/tooltip/index.js +3 -5
- package/dist/index.d.ts +2 -2
- package/dist/internal/TooltipScope.svelte +19 -0
- package/dist/internal/TooltipScope.svelte.d.ts +7 -0
- package/dist/internal/layer.d.ts +6 -3
- package/dist/internal/layer.js +13 -6
- package/package.json +1 -1
- package/skills/building-ui/SKILL.md +32 -32
- package/skills/building-ui/references/components.md +71 -32
- package/skills/markdown/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/styling/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import '../../internal/icons.css';
|
|
7
7
|
import { groupTrigger } from '../../internal/tooltip-trigger.js';
|
|
8
8
|
import * as Tooltip from '../tooltip/index.js';
|
|
9
|
+
import TooltipScope from '../../internal/TooltipScope.svelte';
|
|
9
10
|
import { attrs, type Sx } from '../../internal/sx.js';
|
|
10
11
|
import { colors, font, motion, radius } from '../../tokens.stylex.js';
|
|
11
12
|
import { media } from '../../media.stylex.js';
|
|
@@ -198,7 +199,7 @@
|
|
|
198
199
|
{/each}
|
|
199
200
|
{/snippet}
|
|
200
201
|
{#if tabs.some((tab) => tab.title)}
|
|
201
|
-
<
|
|
202
|
+
<TooltipScope>{@render items()}</TooltipScope>
|
|
202
203
|
{:else}
|
|
203
204
|
{@render items()}
|
|
204
205
|
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { Loose } from '../../internal/loose.js';
|
|
3
|
+
import { Tooltip } from 'bits-ui';
|
|
4
|
+
import { hasContext, setContext } from 'svelte';
|
|
5
|
+
|
|
6
|
+
export type TooltipProviderProps = Loose<Tooltip.ProviderProps>;
|
|
7
|
+
|
|
8
|
+
const PROVIDED = Symbol('narvi.tooltip.provider');
|
|
9
|
+
|
|
10
|
+
/** Whether a Tooltip.Provider of Narvi's is above the calling component. */
|
|
11
|
+
export const hasTooltipProvider = () => hasContext(PROVIDED);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
let { children, ...rest }: TooltipProviderProps = $props();
|
|
16
|
+
|
|
17
|
+
// Narvi's own parts with a tooltip find it, and take its delay rather than one of their own
|
|
18
|
+
setContext(PROVIDED, true);
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<Tooltip.Provider {...rest}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</Tooltip.Provider>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Loose } from '../../internal/loose.js';
|
|
2
|
+
import { Tooltip } from 'bits-ui';
|
|
3
|
+
export type TooltipProviderProps = Loose<Tooltip.ProviderProps>;
|
|
4
|
+
/** Whether a Tooltip.Provider of Narvi's is above the calling component. */
|
|
5
|
+
export declare const hasTooltipProvider: () => boolean;
|
|
6
|
+
declare const TooltipProvider: import("svelte").Component<Loose<Tooltip.ProviderProps>, {}, "">;
|
|
7
|
+
type TooltipProvider = ReturnType<typeof TooltipProvider>;
|
|
8
|
+
export default TooltipProvider;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Tooltip } from 'bits-ui';
|
|
2
|
-
import { type Loosened } from '../../internal/loose.js';
|
|
3
1
|
import Content from './TooltipContent.svelte';
|
|
2
|
+
import Provider from './TooltipProvider.svelte';
|
|
4
3
|
import Root from './TooltipRoot.svelte';
|
|
5
4
|
import Trigger from './TooltipTrigger.svelte';
|
|
6
5
|
/**
|
|
7
|
-
* Place one Provider near the root of the app. Its delay applies to every
|
|
8
|
-
*
|
|
6
|
+
* Place one Provider near the root of the app. Its delay applies to every tooltip inside, Narvi's
|
|
7
|
+
* own parts' among them, and once one is open the next opens without waiting.
|
|
9
8
|
*/
|
|
10
|
-
declare const Provider: Loosened<typeof Tooltip.Provider>;
|
|
11
9
|
export { Provider, Root, Trigger, Content };
|
|
12
10
|
export type { TooltipContentProps } from './TooltipContent.svelte';
|
|
11
|
+
export type { TooltipProviderProps } from './TooltipProvider.svelte';
|
|
13
12
|
export type { TooltipRootProps } from './TooltipRoot.svelte';
|
|
14
13
|
export type { TooltipTriggerProps } from './TooltipTrigger.svelte';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { Tooltip } from 'bits-ui';
|
|
2
|
-
import { loose } from '../../internal/loose.js';
|
|
3
1
|
import Content from './TooltipContent.svelte';
|
|
2
|
+
import Provider from './TooltipProvider.svelte';
|
|
4
3
|
import Root from './TooltipRoot.svelte';
|
|
5
4
|
import Trigger from './TooltipTrigger.svelte';
|
|
6
5
|
/**
|
|
7
|
-
* Place one Provider near the root of the app. Its delay applies to every
|
|
8
|
-
*
|
|
6
|
+
* Place one Provider near the root of the app. Its delay applies to every tooltip inside, Narvi's
|
|
7
|
+
* own parts' among them, and once one is open the next opens without waiting.
|
|
9
8
|
*/
|
|
10
|
-
const Provider = loose(Tooltip.Provider);
|
|
11
9
|
export { Provider, Root, Trigger, Content };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { AvatarFallbackProps, AvatarImageProps, AvatarRootProps, AvatarSize
|
|
|
12
12
|
export { default as Badge } from './components/badge/Badge.svelte';
|
|
13
13
|
export type { BadgeProps, BadgeTone } from './components/badge/Badge.svelte';
|
|
14
14
|
export { default as Button } from './components/button/Button.svelte';
|
|
15
|
-
export type { ButtonProps, ButtonShape, ButtonSize, ButtonVariant } from './components/button/Button.svelte';
|
|
15
|
+
export type { ButtonJustify, ButtonProps, ButtonShape, ButtonSize, ButtonTooltipSide, ButtonVariant } from './components/button/Button.svelte';
|
|
16
16
|
export { default as Card } from './components/card/Card.svelte';
|
|
17
17
|
export type { CardPadding, CardProps, CardVariant } from './components/card/Card.svelte';
|
|
18
18
|
export { default as ChangeStats } from './components/change-stats/ChangeStats.svelte';
|
|
@@ -159,7 +159,7 @@ export type { ToasterProps } from './components/toast/Toaster.svelte';
|
|
|
159
159
|
export { toast } from './components/toast/toasts.svelte.js';
|
|
160
160
|
export type { ToastAction, ToastId, ToastOptions, ToastTone } from './components/toast/toasts.svelte.js';
|
|
161
161
|
export * as Tooltip from './components/tooltip/index.js';
|
|
162
|
-
export type { TooltipContentProps, TooltipRootProps, TooltipTriggerProps } from './components/tooltip/index.js';
|
|
162
|
+
export type { TooltipContentProps, TooltipProviderProps, TooltipRootProps, TooltipTriggerProps } from './components/tooltip/index.js';
|
|
163
163
|
export { default as Theme } from './components/theme/Theme.svelte';
|
|
164
164
|
export type { ThemeOverrides, ThemeProps, ThemeScheme } from './components/theme/Theme.svelte';
|
|
165
165
|
export { default as WorkFold } from './components/work-fold/WorkFold.svelte';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Around a part's tooltips. Inside the app's Tooltip.Provider they are the app's: they wait as
|
|
3
|
+
long as it says, and one opens at once after another anywhere under it, along a toolbar of
|
|
4
|
+
buttons each with its own. Without one they have their own, which waits 400ms.
|
|
5
|
+
-->
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import type { Snippet } from 'svelte';
|
|
8
|
+
import Provider, { hasTooltipProvider } from '../components/tooltip/TooltipProvider.svelte';
|
|
9
|
+
|
|
10
|
+
let { children }: { children: Snippet } = $props();
|
|
11
|
+
|
|
12
|
+
const provided = hasTooltipProvider();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#if provided}
|
|
16
|
+
{@render children()}
|
|
17
|
+
{:else}
|
|
18
|
+
<Provider delayDuration={400}>{@render children()}</Provider>
|
|
19
|
+
{/if}
|
package/dist/internal/layer.d.ts
CHANGED
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as stylex from '@stylexjs/stylex';
|
|
9
9
|
import './icons.css';
|
|
10
|
-
/**
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The `style` that gives a floating surface a `width`, or a least width, of its own, with any
|
|
12
|
+
* `style` given too.
|
|
13
|
+
*/
|
|
14
|
+
export declare function widthStyle(width: string | undefined, style: unknown, minWidth?: string | undefined): string | undefined;
|
|
12
15
|
export declare const layer: Readonly<{
|
|
13
16
|
readonly surface: Readonly<{
|
|
14
17
|
readonly boxSizing: stylex.StyleXClassNameFor<"boxSizing", "border-box">;
|
|
15
18
|
readonly zIndex: stylex.StyleXClassNameFor<"zIndex", 55>;
|
|
16
|
-
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", "max(12rem, var(--bits-floating-anchor-width, 0px))">;
|
|
19
|
+
readonly minWidth: stylex.StyleXClassNameFor<"minWidth", "max(var(--narvi-layer-min-width, 12rem), var(--bits-floating-anchor-width, 0px))">;
|
|
17
20
|
readonly maxWidth: stylex.StyleXClassNameFor<"maxWidth", "min(22rem, var(--bits-floating-available-width, 100vw))">;
|
|
18
21
|
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "var(--bits-floating-available-height, 80vh)">;
|
|
19
22
|
readonly overflowY: stylex.StyleXClassNameFor<"overflowY", "auto">;
|
package/dist/internal/layer.js
CHANGED
|
@@ -12,12 +12,18 @@ import './icons.css';
|
|
|
12
12
|
const CLOSED = ':is([data-state="closed"])';
|
|
13
13
|
const HIGHLIGHTED = ':is([data-highlighted])';
|
|
14
14
|
const DISABLED = ':is([data-disabled])';
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The `style` that gives a floating surface a `width`, or a least width, of its own, with any
|
|
17
|
+
* `style` given too.
|
|
18
|
+
*/
|
|
19
|
+
export function widthStyle(width, style, minWidth) {
|
|
17
20
|
const own = typeof style === 'string' && style ? style : undefined;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const parts = [
|
|
22
|
+
width && `--narvi-layer-width: ${width}`,
|
|
23
|
+
minWidth && `--narvi-layer-min-width: ${minWidth}`,
|
|
24
|
+
own
|
|
25
|
+
].filter(Boolean);
|
|
26
|
+
return parts.length ? parts.join('; ') : undefined;
|
|
21
27
|
}
|
|
22
28
|
export const layer = stylex.create({
|
|
23
29
|
surface: {
|
|
@@ -25,7 +31,8 @@ export const layer = stylex.create({
|
|
|
25
31
|
// Over a dialog (50 and 51) and a sheet, which are where a popup opens while one is up:
|
|
26
32
|
// a modal makes the page behind it inert. Under a tooltip (60) and the toasts (the top layer).
|
|
27
33
|
zIndex: 55,
|
|
28
|
-
|
|
34
|
+
// From 12rem, or a least width of its own, or the trigger's width if that is wider
|
|
35
|
+
minWidth: 'max(var(--narvi-layer-min-width, 12rem), var(--bits-floating-anchor-width, 0px))',
|
|
29
36
|
maxWidth: 'min(22rem, var(--bits-floating-available-width, 100vw))',
|
|
30
37
|
// Never taller than the room left in the window; it scrolls inside instead
|
|
31
38
|
maxHeight: 'var(--bits-floating-available-height, 80vh)',
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ metadata:
|
|
|
12
12
|
Grid, and Narvi's conventions for colour, labels and copy.
|
|
13
13
|
type: core
|
|
14
14
|
library: '@diegopluna/narvi'
|
|
15
|
-
library_version: '0.3.
|
|
15
|
+
library_version: '0.3.7'
|
|
16
16
|
requires:
|
|
17
17
|
- setup
|
|
18
18
|
sources:
|
|
@@ -37,6 +37,10 @@ sources:
|
|
|
37
37
|
- src/lib/components/app-shell/AppShellPanel.svelte
|
|
38
38
|
- src/lib/components/composer/ComposerModelPicker.svelte
|
|
39
39
|
- src/lib/components/questionnaire/Questionnaire.svelte
|
|
40
|
+
- src/lib/components/button/Button.svelte
|
|
41
|
+
- src/lib/components/tooltip/TooltipProvider.svelte
|
|
42
|
+
- src/lib/components/command/*.svelte
|
|
43
|
+
- src/lib/components/menu/MenuContent.svelte
|
|
40
44
|
---
|
|
41
45
|
|
|
42
46
|
# Build interfaces with Narvi
|
|
@@ -300,15 +304,14 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
|
|
|
300
304
|
```
|
|
301
305
|
|
|
302
306
|
- Errors and work under way stay until dismissed, and every toast has a Dismiss button.
|
|
303
|
-
- `Tooltip.Root`
|
|
304
|
-
|
|
307
|
+
- `Tooltip.Root` needs a `Tooltip.Provider` near the root, whose delay and hand-off Narvi's own
|
|
308
|
+
tooltips (Button, Rail, Tabs) take too. An icon button needs an `aria-label` as well.
|
|
305
309
|
- Use `Notice` for a note in place (`tone`: neutral, info, success, warning, danger; `raised`
|
|
306
|
-
over a busy background, such as an image behind the composer),
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
Don't draw a dot as a span of your own.
|
|
310
|
+
over a busy background, such as an image behind the composer), `EmptyState` for an empty
|
|
311
|
+
place, `Skeleton`, `Spinner` or `Progress` while loading, and `StatusIndicator` (`status`:
|
|
312
|
+
idle, working, waiting, done, failed, stopped, connecting) for where a run stands. With no
|
|
313
|
+
room for its shapes, use `StatusDot` (`tone`; `shape`: dot, ring for on its way, diamond for
|
|
314
|
+
failed; `size`, 6px; `label`): don't draw a dot as a span of your own.
|
|
312
315
|
|
|
313
316
|
### Lists, badges and folds
|
|
314
317
|
|
|
@@ -316,28 +319,27 @@ line, `lines={2}` for several). Use `Code` and `Kbd` inline, and
|
|
|
316
319
|
`List.Item`s, or rows of your own. Don't redraw the card and its lines.
|
|
317
320
|
- `Badge` shows its tone as a dot; `plain` hides the dot and colours the words in the tone.
|
|
318
321
|
`color` paints the dot alone in a colour of its own (a label's `#d73a4a`): don't draw a dot.
|
|
319
|
-
`size="sm"` is 18px, a sidebar row's line, so
|
|
320
|
-
it is sized to 12px.
|
|
322
|
+
`size="sm"` is 18px, a sidebar row's line, so a row keeps its height; an icon in it is 12px.
|
|
321
323
|
- `Collapsible.Trigger` takes `chevron="start"` to put the chevron before its label, as in a tree.
|
|
322
|
-
- `Tabs` and `SegmentedControl` options take an `icon`
|
|
323
|
-
`title` that names a short label in full, as a tooltip and the item's description.
|
|
324
|
+
- `Tabs` and `SegmentedControl` options take an `icon` and a `title`: tooltip and description.
|
|
324
325
|
- A loading `Button` hides its label under the spinner; `loadingLabel="Connecting…"` says what
|
|
325
|
-
it does beside it instead. `tooltip` (words or a snippet)
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
the
|
|
330
|
-
look
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
it does beside it instead. `tooltip` (words or a snippet), `tooltipSide` (`bottom` under a
|
|
327
|
+
bar) and `tooltipShortcut` (`['⌘', 'K']`) give it a tooltip, as on `Composer.Submit` and a
|
|
328
|
+
`SplitButton` (`menuTooltip` for its chevron; `onopenchange`): don't wrap one in `Tooltip`
|
|
329
|
+
parts. `justify="start"` starts its contents, for a full-width row, and a margin of `auto`
|
|
330
|
+
sends the last to the end. `variant="link"` sits in a sentence. An open ghost, bare, secondary
|
|
331
|
+
or floating trigger holds an open look by bits-ui's `aria-expanded`, and `pressed` makes a
|
|
332
|
+
toggle button (`aria-pressed`) in that look: style neither.
|
|
333
|
+
- A main action with a menu of how to do it (Merge, Sign in) is a `SplitButton`; don't join two
|
|
334
|
+
Buttons by hand, or retheme its tokens to restyle a half. Its props are in the
|
|
335
|
+
[catalogue](references/components.md#split-buttons).
|
|
334
336
|
- `Toggle` and `ToggleGroup.Root` take `tone="neutral"`: pressed, a toolbar's icon takes the fill
|
|
335
337
|
of what is chosen, not the accent.
|
|
336
338
|
- `Menu.Item`, `Menu.SubTrigger`, `Menu.CheckboxItem` and `Menu.RadioItem` take a
|
|
337
339
|
`description` (a line under the label): a string, or a snippet whose icon is 12px and lies in
|
|
338
340
|
the line; say in words what the icon stands for. All but the SubTrigger take `trailing`. A `Menu.CheckboxItem` with an
|
|
339
341
|
`icon` puts its tick at the end, so its icon lines up with the others'. `Menu.Content` takes a
|
|
340
|
-
`width` (`'18rem'`) in place of fitting its items, up to 22rem
|
|
342
|
+
`width` (`'18rem'`) in place of fitting its items, up to 22rem, or a `minWidth`.
|
|
341
343
|
- `Popover.Content` takes `padding="none"`, `layout="column"` and a `width`;
|
|
342
344
|
`HoverCard.Content` takes `layout="column"` and `padding`; `Tooltip.Content` takes
|
|
343
345
|
`layout="column"` for a title over a line that says more.
|
|
@@ -391,17 +393,15 @@ Parts of the shell that are easy to redraw by hand, and shouldn't be:
|
|
|
391
393
|
what scrolls, in the same tab stop and arrow-key order. Don't add a second `Sidebar.Content`.
|
|
392
394
|
- **A mark with a badge** in a row's `meta` may overhang it; the line clips only far past its end.
|
|
393
395
|
- `AppShell.Main` is not focusable, so a press on text in the page leaves focus where it was.
|
|
394
|
-
- **TabStrip** tabs narrow to an ellipsis before the strip scrolls
|
|
395
|
-
tab's close button takes the icon's place
|
|
396
|
-
|
|
397
|
-
a long press), `onmove(id, index)` (drag, or Alt+Shift+arrow), `onrename(id, label)` with
|
|
398
|
-
`bind:renaming` (double-click, F2, or a menu's Rename), `trailing` for a tab's own buttons,
|
|
399
|
-
`beside` for the tab shown in a split, and per tab `tabId`, `panelId`, `title`, `renamable`.
|
|
400
|
-
Arrows open the tab they reach (`activation="manual"` only moves focus); `onchange(id)`; a
|
|
401
|
-
name cleared comes as `''`; `addMenu` (Menu parts) makes the add button open a menu.
|
|
396
|
+
- **TabStrip** tabs narrow to an ellipsis before the strip scrolls; with a `leading` icon, a
|
|
397
|
+
tab's close button takes the icon's place. A side panel's tabs are a TabStrip too, with menus,
|
|
398
|
+
dragging, renaming and an add menu: see the [catalogue](references/components.md#tab-strips).
|
|
402
399
|
- **AppShell.Panel** goes narrow by its row, not the window; `maximized` lays it over the page,
|
|
403
400
|
kept inert, so give it an `AppShell.Header` with `AppShell.Toggle when="closed"`. Beside a
|
|
404
|
-
thread, put it in a flex row of yours (`position: relative`) inside `AppShell.Main
|
|
401
|
+
thread, put it in a flex row of yours (`position: relative`) inside `AppShell.Main`; for
|
|
402
|
+
`hideCovered`, `edgeLabel` and `edgeTitle` see the [catalogue](references/components.md#panels).
|
|
403
|
+
- **A palette** is `Command.Root`: don't work round its keys, highlight, footer or field by hand
|
|
404
|
+
(the [catalogue](references/components.md#palettes) says what each does).
|
|
405
405
|
- **A Sheet** focuses itself as it opens (`focusOnOpen="sheet"`), so a Rail or a list in it
|
|
406
406
|
shows no focus ring until the keys move in. Pass `focusOnOpen="first"` for a sheet that
|
|
407
407
|
holds a form.
|
|
@@ -26,41 +26,72 @@ component: import the namespace (`Dialog`) and use `Dialog.Root`. Docs and live
|
|
|
26
26
|
|
|
27
27
|
## Controls and forms
|
|
28
28
|
|
|
29
|
-
| Component | Use it for
|
|
30
|
-
| --------------------------- |
|
|
31
|
-
| `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `loading`, `iconOnly`, `pressed`
|
|
32
|
-
| `Field` | Label, help text and error around one control
|
|
33
|
-
| `Input` | One line of text
|
|
34
|
-
| `Textarea` | Several lines of text
|
|
35
|
-
| `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`)
|
|
36
|
-
| `Checkbox` | An option on or off, or several from a list
|
|
37
|
-
| `ChoiceCards` | One choice among a few, each a card with a title and a line of detail
|
|
38
|
-
| `Switch` | A setting that takes effect at once
|
|
39
|
-
| `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`)
|
|
40
|
-
| `Slider` | A value or a range along a track
|
|
41
|
-
| `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant`)
|
|
42
|
-
| `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons)
|
|
43
|
-
| `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number
|
|
44
|
-
| `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card
|
|
45
|
-
| `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`)
|
|
46
|
-
| `Tabs` | Views that share one place (`items: TabItem[]`)
|
|
47
|
-
| `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar
|
|
48
|
-
| `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `trailing`. The panels are yours
|
|
29
|
+
| Component | Use it for | Docs slug |
|
|
30
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
31
|
+
| `Button` | An action; `href` makes it a link; `variant` (12, from `primary` to `success-outline`), `size` (`micro` to `lg`), `shape`, `justify`, `loading`, `iconOnly`, `pressed`, `tooltip` | `button` |
|
|
32
|
+
| `Field` | Label, help text and error around one control | `field` |
|
|
33
|
+
| `Input` | One line of text | `input` |
|
|
34
|
+
| `Textarea` | Several lines of text | `textarea` |
|
|
35
|
+
| `Select` | One choice from a short list (`options: { value, label, icon?, detail?, detailMono?, group? }[]`, `align`, `optionIcon`) | `select` |
|
|
36
|
+
| `Checkbox` | An option on or off, or several from a list | `checkbox` |
|
|
37
|
+
| `ChoiceCards` | One choice among a few, each a card with a title and a line of detail | `choice-cards` |
|
|
38
|
+
| `Switch` | A setting that takes effect at once | `switch` |
|
|
39
|
+
| `SegmentedControl` | One of a few options, all visible (`options: { value, label, title? }[]`, `onchange`) | `segmented-control` |
|
|
40
|
+
| `Slider` | A value or a range along a track | `slider` |
|
|
41
|
+
| `SplitButton` | A main action joined to a menu of how to do it (`menu`, `menuLabel`, `label`, `variant` incl. `ghost`, `shape`, `mainDisabled`, `mainSx`/`menuSx`, `menuMinWidth`) | `split-button` |
|
|
42
|
+
| `Toggle` | A button that stays pressed (`tone`: `accent`, or `neutral` for toolbar icons) | `toggle` |
|
|
43
|
+
| `ToggleGroup.Root`, `.Item` | Toggles that belong together: one pressed, or any number | `toggle-group` |
|
|
44
|
+
| `SettingsGroup` | A titled group of settings: a heading, an action, the rows on one card | `settings-group` |
|
|
45
|
+
| `SettingsRow` | One setting: what it is, beside its control (`leading`, `dimmed`, `mono`) | `settings-row` |
|
|
46
|
+
| `Tabs` | Views that share one place (`items: TabItem[]`) | `tabs` |
|
|
47
|
+
| `SearchButton` | Looks like a search field and opens search (`label`, `shortcut`): for a window's bar | `search-button` |
|
|
48
|
+
| `TabStrip` | Tabs for what is open in a pane: closable, addable, scrolling (`tabs`, `bind:value`, `onclose`, `onadd`); `menu`, `onmove`, `onrename`, `trailing`. The panels are yours | `tab-strip` |
|
|
49
|
+
|
|
50
|
+
### Tab strips
|
|
51
|
+
|
|
52
|
+
A side panel's tabs are a `TabStrip`: `menu` (a snippet of Menu parts, given the tab:
|
|
53
|
+
right-click, the menu key, a long press), `onmove(id, index)` (drag, or Alt+Shift+arrow),
|
|
54
|
+
`onrename(id, label)` with `bind:renaming` (double-click, F2, or a menu's Rename), `trailing`
|
|
55
|
+
for a tab's own buttons, `beside` for the tab shown in a split, and per tab `tabId`, `panelId`,
|
|
56
|
+
`title`, `renamable`. Arrows open the tab they reach (`activation="manual"` only moves focus);
|
|
57
|
+
`onchange(id)`; a name cleared comes as `''`; `addMenu` (Menu parts) makes the add button open
|
|
58
|
+
a menu.
|
|
59
|
+
|
|
60
|
+
### Split buttons
|
|
61
|
+
|
|
62
|
+
`SplitButton` takes a `menu` snippet, `menuLabel` for the chevron and `label` for the group.
|
|
63
|
+
Both halves are disabled together; `mainDisabled` disables the main one alone, so the menu stays
|
|
64
|
+
in reach. Without `menu` it stands alone. `variant="ghost"` is the quiet one for a bar, with a
|
|
65
|
+
short line between the halves (give it a fill of its own with `sx`); `shape="pill"` rounds its
|
|
66
|
+
outer ends; `mainSx` and `menuSx` style each half after its own styles; `menuWidth` and
|
|
67
|
+
`menuMinWidth` size the menu, as `Menu.Content`'s `width` and `minWidth` do.
|
|
49
68
|
|
|
50
69
|
## Overlays (bits-ui; use `child` snippets on triggers)
|
|
51
70
|
|
|
52
|
-
| Component | Use it for
|
|
53
|
-
| --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
-
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page
|
|
55
|
-
| `ConfirmDialog` | A confirmation for an action that matters
|
|
56
|
-
| `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge
|
|
57
|
-
| `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it
|
|
58
|
-
| `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip
|
|
59
|
-
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing`
|
|
60
|
-
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click
|
|
61
|
-
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`; items
|
|
62
|
-
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider
|
|
63
|
-
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away
|
|
71
|
+
| Component | Use it for | Docs slug |
|
|
72
|
+
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
|
|
73
|
+
| `Dialog.Root`, `.Trigger`, `.Content` (`size`, `side`, `as`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A focused task over the page | `dialog` |
|
|
74
|
+
| `ConfirmDialog` | A confirmation for an action that matters | `dialog` |
|
|
75
|
+
| `Sheet.Root`, `.Trigger`, `.Content` (`side`, `size`, `focusOnOpen`), `.Header`, `.Title`, `.Description`, `.Body`, `.Footer`, `.Close` | A panel that slides in from an edge | `sheet` |
|
|
76
|
+
| `Popover.Root`, `.Trigger`, `.Content` (`padding`, `layout`, `width`), `.Close` | Content anchored to the control that opened it | `popover` |
|
|
77
|
+
| `HoverCard.Root`, `.Trigger`, `.Content` (`layout`, `padding`) | A preview while the pointer rests on a link or chip | `hover-card` |
|
|
78
|
+
| `Menu.Root`, `.Trigger`, `.Content`, `.Item`, `.CheckboxItem`, `.RadioGroup`, `.RadioItem`, `.Group`, `.Label`, `.Separator`, `.Sub` | Actions and choices from a button; items take `description` (text or a snippet) and `trailing` | `menu` |
|
|
79
|
+
| `ContextMenu.Root`, `.Trigger`, `.Content`, filled with `Menu` items | The same, from a right-click | `menu` |
|
|
80
|
+
| `Command.Dialog`, `.Root`, `.Input`, `.List`, `.Group`, `.Item`, `.Empty`, `.Separator`, `.Footer` | A search field over everything the app can do (⌘K); drive it from outside with `Input` `bind:value`, `Root` `shouldFilter={false}` and `bind:value` (the highlighted item), and `Dialog` `onescape`, `restoreFocus`, `sx`; `Input` an `end` snippet; items a snippet `detail`, `wrapDetail`, `badge` and a `hint`; `Empty` a `status` (`loading`, `error`) | `command` |
|
|
81
|
+
| `Tooltip.Provider`, `.Root`, `.Trigger`, `.Content` (`shortcut`, `layout`) | A control's name and its keys. Needs the Provider | `tooltip` |
|
|
82
|
+
| `Collapsible.Root`, `.Trigger`, `.Content` | A region the person can fold away | `collapsible` |
|
|
83
|
+
|
|
84
|
+
### Palettes
|
|
85
|
+
|
|
86
|
+
`Command.Root` passes keys to its list only from the root and its `Command.Input`: a button, a
|
|
87
|
+
field or a form of yours inside it keeps its keys, Enter among them, and the field keeps Home and
|
|
88
|
+
End for its caret. Ctrl+J/K/N/P are left to the app unless `vimBindings` is set. When the
|
|
89
|
+
highlighted item is removed, the highlight goes back to the first. `Command.Input` takes an `end`
|
|
90
|
+
snippet after the field; `Command.Item` a `badge` after the label and `wrapDetail` for a path
|
|
91
|
+
whose end matters; `Command.Empty` a `status` of `loading` (a spinner) or `error` (the danger
|
|
92
|
+
colour); `Command.Dialog` an `sx` for its place and width. `Command.Footer` is read out: pass
|
|
93
|
+
`aria-hidden="true"` only for hints alone. Command.Empty is not announced; say loading and
|
|
94
|
+
errors with an `Announcer` too.
|
|
64
95
|
|
|
65
96
|
## Feedback and status
|
|
66
97
|
|
|
@@ -150,6 +181,14 @@ first. Don't use a rail without a bar in a window that has traffic lights: they
|
|
|
150
181
|
</AppShell.Root>
|
|
151
182
|
```
|
|
152
183
|
|
|
184
|
+
### Panels
|
|
185
|
+
|
|
186
|
+
`AppShell.Panel` is raised wherever it stands, so don't give it `bgRaised` of your own. In a
|
|
187
|
+
flex row of yours inside `AppShell.Main`, lying over the row it makes the row's other children
|
|
188
|
+
inert, and with `hideCovered` hides them too (still laid out, so their scroll is kept); they
|
|
189
|
+
come back as they were. `edgeLabel` names its resize edge for assistive technology ("Resize
|
|
190
|
+
panel"), and `edgeTitle` gives the edge a tooltip ("Drag to resize, double-click to reset").
|
|
191
|
+
|
|
153
192
|
## AI chat
|
|
154
193
|
|
|
155
194
|
| Component | Use it for | Docs slug |
|
package/skills/markdown/SKILL.md
CHANGED
package/skills/setup/SKILL.md
CHANGED
package/skills/styling/SKILL.md
CHANGED
package/skills/theming/SKILL.md
CHANGED