@robzepdev/trama 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +44 -3
  3. package/dist/AGENTS.md +19 -0
  4. package/dist/components/button.d.mts +30 -0
  5. package/dist/components/button.mjs +32 -0
  6. package/dist/components/card.d.mts +19 -0
  7. package/dist/components/card.mjs +77 -0
  8. package/dist/components/checkbox.d.mts +13 -0
  9. package/dist/components/checkbox.mjs +33 -0
  10. package/dist/components/dialog.d.mts +25 -0
  11. package/dist/components/dialog.mjs +97 -0
  12. package/dist/components/field.d.mts +18 -0
  13. package/dist/components/field.mjs +41 -0
  14. package/dist/components/input.d.mts +4 -0
  15. package/dist/components/input.mjs +14 -0
  16. package/dist/components/menu.d.mts +22 -0
  17. package/dist/components/menu.mjs +89 -0
  18. package/dist/components/select.d.mts +25 -0
  19. package/dist/components/select.mjs +127 -0
  20. package/dist/components/stack.d.mts +48 -0
  21. package/dist/components/stack.mjs +196 -0
  22. package/dist/components/text.d.mts +25 -0
  23. package/dist/components/text.mjs +81 -0
  24. package/dist/components/toast.d.mts +15 -0
  25. package/dist/components/toast.mjs +49 -0
  26. package/dist/docs/button.md +84 -0
  27. package/dist/docs/card-content.md +41 -0
  28. package/dist/docs/card-description.md +41 -0
  29. package/dist/docs/card-footer.md +41 -0
  30. package/dist/docs/card-header.md +41 -0
  31. package/dist/docs/card-title.md +41 -0
  32. package/dist/docs/card.md +41 -0
  33. package/dist/docs/checkbox.md +142 -0
  34. package/dist/docs/dialog-close.md +53 -0
  35. package/dist/docs/dialog-content.md +70 -0
  36. package/dist/docs/dialog-description.md +46 -0
  37. package/dist/docs/dialog-footer.md +28 -0
  38. package/dist/docs/dialog-header.md +28 -0
  39. package/dist/docs/dialog-title.md +46 -0
  40. package/dist/docs/dialog-trigger.md +70 -0
  41. package/dist/docs/dialog.md +100 -0
  42. package/dist/docs/field-description.md +69 -0
  43. package/dist/docs/field-error.md +77 -0
  44. package/dist/docs/field-label.md +77 -0
  45. package/dist/docs/field.md +128 -0
  46. package/dist/docs/index.md +41 -0
  47. package/dist/docs/input.md +46 -0
  48. package/dist/docs/menu-content.md +95 -0
  49. package/dist/docs/menu-group.md +51 -0
  50. package/dist/docs/menu-item.md +79 -0
  51. package/dist/docs/menu-label.md +46 -0
  52. package/dist/docs/menu-separator.md +51 -0
  53. package/dist/docs/menu-trigger.md +93 -0
  54. package/dist/docs/menu.md +135 -0
  55. package/dist/docs/select-content.md +91 -0
  56. package/dist/docs/select-group.md +46 -0
  57. package/dist/docs/select-item.md +75 -0
  58. package/dist/docs/select-label.md +46 -0
  59. package/dist/docs/select-separator.md +51 -0
  60. package/dist/docs/select-trigger.md +63 -0
  61. package/dist/docs/select-value.md +59 -0
  62. package/dist/docs/select.md +164 -0
  63. package/dist/docs/stack.md +58 -0
  64. package/dist/docs/text.md +60 -0
  65. package/dist/docs/toast-provider.md +34 -0
  66. package/dist/index.d.mts +12 -0
  67. package/dist/index.mjs +12 -0
  68. package/dist/lib/cn.mjs +9 -0
  69. package/dist/lib/responsive.d.mts +4 -0
  70. package/dist/lib/responsive.mjs +17 -0
  71. package/package.json +67 -3
  72. package/styles.css +67 -0
  73. package/themes/brutalista.css +36 -0
  74. package/themes/neon.css +37 -0
@@ -0,0 +1,41 @@
1
+ # CardDescription
2
+
3
+ Supporting text under the title.
4
+
5
+ ```tsx
6
+ import { CardDescription } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `render`
14
+ Type: `ComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
15
+
16
+ Allows you to replace the component's HTML element
17
+ with a different tag, or compose it with another component.
18
+
19
+ Accepts a `ReactElement` or a function that returns the element to render.
20
+
21
+ ## Examples
22
+
23
+ ```tsx
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="p-4">
27
+ <Card className="max-w-sm">
28
+ <CardHeader>
29
+ <CardTitle>Team plan</CardTitle>
30
+ <CardDescription>Up to ten members, billed monthly.</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>Includes shared workspaces and priority support.</CardContent>
33
+ <CardFooter>
34
+ <Button>Upgrade</Button>
35
+ <Button variant="outline">Cancel</Button>
36
+ </CardFooter>
37
+ </Card>
38
+ </div>
39
+ ),
40
+ };
41
+ ```
@@ -0,0 +1,41 @@
1
+ # CardFooter
2
+
3
+ Bottom of the card, usually actions.
4
+
5
+ ```tsx
6
+ import { CardFooter } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `render`
14
+ Type: `ComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
15
+
16
+ Allows you to replace the component's HTML element
17
+ with a different tag, or compose it with another component.
18
+
19
+ Accepts a `ReactElement` or a function that returns the element to render.
20
+
21
+ ## Examples
22
+
23
+ ```tsx
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="p-4">
27
+ <Card className="max-w-sm">
28
+ <CardHeader>
29
+ <CardTitle>Team plan</CardTitle>
30
+ <CardDescription>Up to ten members, billed monthly.</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>Includes shared workspaces and priority support.</CardContent>
33
+ <CardFooter>
34
+ <Button>Upgrade</Button>
35
+ <Button variant="outline">Cancel</Button>
36
+ </CardFooter>
37
+ </Card>
38
+ </div>
39
+ ),
40
+ };
41
+ ```
@@ -0,0 +1,41 @@
1
+ # CardHeader
2
+
3
+ Top of the card: holds `CardTitle` and `CardDescription`.
4
+
5
+ ```tsx
6
+ import { CardHeader } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `render`
14
+ Type: `ComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
15
+
16
+ Allows you to replace the component's HTML element
17
+ with a different tag, or compose it with another component.
18
+
19
+ Accepts a `ReactElement` or a function that returns the element to render.
20
+
21
+ ## Examples
22
+
23
+ ```tsx
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="p-4">
27
+ <Card className="max-w-sm">
28
+ <CardHeader>
29
+ <CardTitle>Team plan</CardTitle>
30
+ <CardDescription>Up to ten members, billed monthly.</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>Includes shared workspaces and priority support.</CardContent>
33
+ <CardFooter>
34
+ <Button>Upgrade</Button>
35
+ <Button variant="outline">Cancel</Button>
36
+ </CardFooter>
37
+ </Card>
38
+ </div>
39
+ ),
40
+ };
41
+ ```
@@ -0,0 +1,41 @@
1
+ # CardTitle
2
+
3
+ Title of the card. Change the heading level through `render`, e.g. `render={<h2 />}`.
4
+
5
+ ```tsx
6
+ import { CardTitle } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `render`
14
+ Type: `ComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
15
+
16
+ Allows you to replace the component's HTML element
17
+ with a different tag, or compose it with another component.
18
+
19
+ Accepts a `ReactElement` or a function that returns the element to render.
20
+
21
+ ## Examples
22
+
23
+ ```tsx
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="p-4">
27
+ <Card className="max-w-sm">
28
+ <CardHeader>
29
+ <CardTitle>Team plan</CardTitle>
30
+ <CardDescription>Up to ten members, billed monthly.</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>Includes shared workspaces and priority support.</CardContent>
33
+ <CardFooter>
34
+ <Button>Upgrade</Button>
35
+ <Button variant="outline">Cancel</Button>
36
+ </CardFooter>
37
+ </Card>
38
+ </div>
39
+ ),
40
+ };
41
+ ```
@@ -0,0 +1,41 @@
1
+ # Card
2
+
3
+ Surface that groups related content. Colors, shadow and radius come from the theme.
4
+
5
+ ```tsx
6
+ import { Card } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `render`
14
+ Type: `ComponentRenderFn<HTMLProps, {}> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
15
+
16
+ Allows you to replace the component's HTML element
17
+ with a different tag, or compose it with another component.
18
+
19
+ Accepts a `ReactElement` or a function that returns the element to render.
20
+
21
+ ## Examples
22
+
23
+ ```tsx
24
+ export const Default: Story = {
25
+ render: () => (
26
+ <div className="p-4">
27
+ <Card className="max-w-sm">
28
+ <CardHeader>
29
+ <CardTitle>Team plan</CardTitle>
30
+ <CardDescription>Up to ten members, billed monthly.</CardDescription>
31
+ </CardHeader>
32
+ <CardContent>Includes shared workspaces and priority support.</CardContent>
33
+ <CardFooter>
34
+ <Button>Upgrade</Button>
35
+ <Button variant="outline">Cancel</Button>
36
+ </CardFooter>
37
+ </Card>
38
+ </div>
39
+ ),
40
+ };
41
+ ```
@@ -0,0 +1,142 @@
1
+ # Checkbox
2
+
3
+ Checkbox with the shadcn/ui API on top of Base UI. Use it inside `Field` from Base UI for a label.
4
+
5
+ ```tsx
6
+ import { Checkbox } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `checked`
14
+ Type: `boolean | undefined`
15
+
16
+ Whether the checkbox is checked (controlled).
17
+
18
+ ### `className`
19
+ Type: `string | ((state: CheckboxRootState) => string | undefined) | undefined`
20
+
21
+ CSS class applied to the element, or a function that
22
+ returns a class based on the component's state.
23
+
24
+ ### `defaultChecked`
25
+ Type: `boolean | undefined`
26
+
27
+ Whether the checkbox is initially checked (uncontrolled).
28
+
29
+ ### `disabled`
30
+ Type: `boolean | undefined`
31
+
32
+ Whether the checkbox should ignore user interaction.
33
+
34
+ ### `form`
35
+ Type: `string | undefined`
36
+
37
+ Identifies the form that owns the hidden input.
38
+ Useful when the checkbox is rendered outside the form.
39
+
40
+ ### `id`
41
+ Type: `string | undefined`
42
+
43
+ The id of the input element.
44
+
45
+ ### `indeterminate`
46
+ Type: `boolean | undefined`
47
+
48
+ Whether the checkbox is in a mixed state, neither checked nor unchecked.
49
+
50
+ ### `inputRef`
51
+ Type: `Ref<HTMLInputElement> | undefined`
52
+
53
+ A ref to access the hidden `<input>` element.
54
+
55
+ ### `name`
56
+ Type: `string | undefined`, default: undefined
57
+
58
+ Identifies the field when a form is submitted.
59
+
60
+ ### `nativeButton`
61
+ Type: `boolean | undefined`, default: false
62
+
63
+ Whether the component renders a native `<button>` element when replacing it
64
+ via the `render` prop.
65
+ Set to `true` if the rendered element is a native button.
66
+
67
+ ### `onCheckedChange`
68
+ Type: `((checked: boolean, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void) | undefined`
69
+
70
+ Event handler called when the checkbox is ticked or unticked.
71
+
72
+ ### `parent`
73
+ Type: `boolean | undefined`, default: false
74
+
75
+ Whether the checkbox controls a group of child checkboxes.
76
+
77
+ Must be used in a [Checkbox Group](https://base-ui.com/react/components/checkbox-group).
78
+
79
+ ### `readOnly`
80
+ Type: `boolean | undefined`, default: false
81
+
82
+ Whether the user should be unable to tick or untick the checkbox.
83
+
84
+ ### `render`
85
+ Type: `ComponentRenderFn<HTMLProps, CheckboxRootState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
86
+
87
+ Allows you to replace the component's HTML element
88
+ with a different tag, or compose it with another component.
89
+
90
+ Accepts a `ReactElement` or a function that returns the element to render.
91
+
92
+ ### `required`
93
+ Type: `boolean | undefined`, default: false
94
+
95
+ Whether the user must tick the checkbox before submitting a form.
96
+
97
+ ### `style`
98
+ Type: `CSSProperties | ((state: CheckboxRootState) => CSSProperties | undefined) | undefined`
99
+
100
+ Style applied to the element, or a function that
101
+ returns a style object based on the component's state.
102
+
103
+ ### `uncheckedValue`
104
+ Type: `string | undefined`
105
+
106
+ The value submitted with the form when the checkbox is unchecked.
107
+ By default, unchecked checkboxes do not submit any value, matching native checkbox behavior.
108
+
109
+ ### `value`
110
+ Type: `string | undefined`
111
+
112
+ The checkbox's value. Identifies it within a [Checkbox Group](https://base-ui.com/react/components/checkbox-group), falling back to `name` when omitted.
113
+ When submitting a form, a checked box submits `value`; with no `value`, it submits the native "on".
114
+
115
+ ## Examples
116
+
117
+ ```tsx
118
+ export const States: Story = {
119
+ render: () => (
120
+ <div className="flex items-center gap-4 p-4">
121
+ <Checkbox aria-label="Unchecked" />
122
+ <Checkbox aria-label="Checked" defaultChecked />
123
+ <Checkbox aria-label="Indeterminate" indeterminate />
124
+ <Checkbox aria-label="Disabled" disabled />
125
+ </div>
126
+ ),
127
+ };
128
+ ```
129
+
130
+ ```tsx
131
+ export const WithLabel: Story = {
132
+ render: () => (
133
+ <div className="p-4">
134
+ <Field.Root>
135
+ <Field.Label className="flex items-center gap-2 text-sm">
136
+ <Checkbox aria-label={undefined} /> Accept terms
137
+ </Field.Label>
138
+ </Field.Root>
139
+ </div>
140
+ ),
141
+ };
142
+ ```
@@ -0,0 +1,53 @@
1
+ # DialogClose
2
+
3
+ Button that closes the dialog.
4
+
5
+ ```tsx
6
+ import { DialogClose } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `className`
14
+ Type: `string | ((state: DialogCloseState) => string | undefined) | undefined`
15
+
16
+ CSS class applied to the element, or a function that
17
+ returns a class based on the component's state.
18
+
19
+ ### `nativeButton`
20
+ Type: `boolean | undefined`, default: true
21
+
22
+ Whether the component renders a native `<button>` element when replacing it
23
+ via the `render` prop.
24
+ Set to `false` if the rendered element is not a button (for example, `<div>`).
25
+
26
+ ### `render`
27
+ Type: `ComponentRenderFn<HTMLProps, DialogCloseState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
28
+
29
+ Allows you to replace the component's HTML element
30
+ with a different tag, or compose it with another component.
31
+
32
+ Accepts a `ReactElement` or a function that returns the element to render.
33
+
34
+ ### `style`
35
+ Type: `CSSProperties | ((state: DialogCloseState) => CSSProperties | undefined) | undefined`
36
+
37
+ Style applied to the element, or a function that
38
+ returns a style object based on the component's state.
39
+
40
+ ## Examples
41
+
42
+ ```tsx
43
+ export const InThemedSubtree: Story = {
44
+ args: { defaultOpen: true },
45
+ render: (args) => (
46
+ <div className="p-4" data-theme="neon" data-scheme="dark">
47
+ <div className="bg-background p-4 text-foreground">
48
+ <Example {...args} />
49
+ </div>
50
+ </div>
51
+ ),
52
+ };
53
+ ```
@@ -0,0 +1,70 @@
1
+ # DialogContent
2
+
3
+ Popup with its backdrop, in a portal. It takes the theme and scheme of the subtree the trigger is in.
4
+
5
+ ```tsx
6
+ import { DialogContent } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `className`
14
+ Type: `string | ((state: DialogPopupState) => string | undefined) | undefined`
15
+
16
+ CSS class applied to the element, or a function that
17
+ returns a class based on the component's state.
18
+
19
+ ### `finalFocus`
20
+ Type: `boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | undefined`
21
+
22
+ Determines the element to focus when the dialog is closed.
23
+
24
+ - `false`: Do not move focus.
25
+ - `true`: Move focus based on the default behavior (trigger or previously focused element).
26
+ - `RefObject`: Move focus to the ref element.
27
+ - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).
28
+ Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing.
29
+
30
+ ### `initialFocus`
31
+ Type: `boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null) | undefined`
32
+
33
+ Determines the element to focus when the dialog is opened.
34
+ By default, focus moves to the first tabbable element inside the popup, except when the dialog
35
+ is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard.
36
+
37
+ - `false`: Do not move focus.
38
+ - `true`: Move focus based on the default behavior (first tabbable element or popup).
39
+ - `RefObject`: Move focus to the ref element.
40
+ - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).
41
+ Return an element to focus, `true` to use the default behavior, `null` to fall back to the default behavior, or `false`/`undefined` to do nothing.
42
+
43
+ ### `render`
44
+ Type: `ComponentRenderFn<HTMLProps, DialogPopupState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
45
+
46
+ Allows you to replace the component's HTML element
47
+ with a different tag, or compose it with another component.
48
+
49
+ Accepts a `ReactElement` or a function that returns the element to render.
50
+
51
+ ### `style`
52
+ Type: `CSSProperties | ((state: DialogPopupState) => CSSProperties | undefined) | undefined`
53
+
54
+ Style applied to the element, or a function that
55
+ returns a style object based on the component's state.
56
+
57
+ ## Examples
58
+
59
+ ```tsx
60
+ export const InThemedSubtree: Story = {
61
+ args: { defaultOpen: true },
62
+ render: (args) => (
63
+ <div className="p-4" data-theme="neon" data-scheme="dark">
64
+ <div className="bg-background p-4 text-foreground">
65
+ <Example {...args} />
66
+ </div>
67
+ </div>
68
+ ),
69
+ };
70
+ ```
@@ -0,0 +1,46 @@
1
+ # DialogDescription
2
+
3
+ Accessible description of the dialog.
4
+
5
+ ```tsx
6
+ import { DialogDescription } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `className`
14
+ Type: `string | ((state: DialogDescriptionState) => string | undefined) | undefined`
15
+
16
+ CSS class applied to the element, or a function that
17
+ returns a class based on the component's state.
18
+
19
+ ### `render`
20
+ Type: `ComponentRenderFn<HTMLProps, DialogDescriptionState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
21
+
22
+ Allows you to replace the component's HTML element
23
+ with a different tag, or compose it with another component.
24
+
25
+ Accepts a `ReactElement` or a function that returns the element to render.
26
+
27
+ ### `style`
28
+ Type: `CSSProperties | ((state: DialogDescriptionState) => CSSProperties | undefined) | undefined`
29
+
30
+ Style applied to the element, or a function that
31
+ returns a style object based on the component's state.
32
+
33
+ ## Examples
34
+
35
+ ```tsx
36
+ export const InThemedSubtree: Story = {
37
+ args: { defaultOpen: true },
38
+ render: (args) => (
39
+ <div className="p-4" data-theme="neon" data-scheme="dark">
40
+ <div className="bg-background p-4 text-foreground">
41
+ <Example {...args} />
42
+ </div>
43
+ </div>
44
+ ),
45
+ };
46
+ ```
@@ -0,0 +1,28 @@
1
+ # DialogFooter
2
+
3
+ Holds the actions, usually `DialogClose` buttons.
4
+
5
+ ```tsx
6
+ import { DialogFooter } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+
14
+
15
+ ## Examples
16
+
17
+ ```tsx
18
+ export const InThemedSubtree: Story = {
19
+ args: { defaultOpen: true },
20
+ render: (args) => (
21
+ <div className="p-4" data-theme="neon" data-scheme="dark">
22
+ <div className="bg-background p-4 text-foreground">
23
+ <Example {...args} />
24
+ </div>
25
+ </div>
26
+ ),
27
+ };
28
+ ```
@@ -0,0 +1,28 @@
1
+ # DialogHeader
2
+
3
+ Groups the title and description.
4
+
5
+ ```tsx
6
+ import { DialogHeader } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+
14
+
15
+ ## Examples
16
+
17
+ ```tsx
18
+ export const InThemedSubtree: Story = {
19
+ args: { defaultOpen: true },
20
+ render: (args) => (
21
+ <div className="p-4" data-theme="neon" data-scheme="dark">
22
+ <div className="bg-background p-4 text-foreground">
23
+ <Example {...args} />
24
+ </div>
25
+ </div>
26
+ ),
27
+ };
28
+ ```
@@ -0,0 +1,46 @@
1
+ # DialogTitle
2
+
3
+ Accessible name of the dialog.
4
+
5
+ ```tsx
6
+ import { DialogTitle } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `className`
14
+ Type: `string | ((state: DialogTitleState) => string | undefined) | undefined`
15
+
16
+ CSS class applied to the element, or a function that
17
+ returns a class based on the component's state.
18
+
19
+ ### `render`
20
+ Type: `ComponentRenderFn<HTMLProps, DialogTitleState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
21
+
22
+ Allows you to replace the component's HTML element
23
+ with a different tag, or compose it with another component.
24
+
25
+ Accepts a `ReactElement` or a function that returns the element to render.
26
+
27
+ ### `style`
28
+ Type: `CSSProperties | ((state: DialogTitleState) => CSSProperties | undefined) | undefined`
29
+
30
+ Style applied to the element, or a function that
31
+ returns a style object based on the component's state.
32
+
33
+ ## Examples
34
+
35
+ ```tsx
36
+ export const InThemedSubtree: Story = {
37
+ args: { defaultOpen: true },
38
+ render: (args) => (
39
+ <div className="p-4" data-theme="neon" data-scheme="dark">
40
+ <div className="bg-background p-4 text-foreground">
41
+ <Example {...args} />
42
+ </div>
43
+ </div>
44
+ ),
45
+ };
46
+ ```
@@ -0,0 +1,70 @@
1
+ # DialogTrigger
2
+
3
+ Button that opens the dialog.
4
+
5
+ ```tsx
6
+ import { DialogTrigger } from "@robzepdev/trama";
7
+ ```
8
+
9
+ ## Props
10
+
11
+ Every other prop of the underlying DOM element is accepted as well.
12
+
13
+ ### `className`
14
+ Type: `string | ((state: DialogTriggerState) => string | undefined) | undefined`
15
+
16
+ CSS class applied to the element, or a function that
17
+ returns a class based on the component's state.
18
+
19
+ ### `handle`
20
+ Type: `DialogHandle<unknown> | undefined`
21
+
22
+ A handle to associate the trigger with a dialog.
23
+ Can be created with the Dialog.createHandle() method.
24
+
25
+ ### `id`
26
+ Type: `string | undefined`
27
+
28
+ ID of the trigger. In addition to being forwarded to the rendered element,
29
+ it is also used to specify the active trigger for the dialog in controlled mode (with the DialogRoot `triggerId` prop).
30
+
31
+ ### `nativeButton`
32
+ Type: `boolean | undefined`, default: true
33
+
34
+ Whether the component renders a native `<button>` element when replacing it
35
+ via the `render` prop.
36
+ Set to `false` if the rendered element is not a button (for example, `<div>`).
37
+
38
+ ### `payload`
39
+ Type: `unknown`
40
+
41
+ A payload to pass to the dialog when it is opened.
42
+
43
+ ### `render`
44
+ Type: `ComponentRenderFn<HTMLProps, DialogTriggerState> | ReactElement<unknown, string | JSXElementConstructor<any>> | undefined`
45
+
46
+ Allows you to replace the component's HTML element
47
+ with a different tag, or compose it with another component.
48
+
49
+ Accepts a `ReactElement` or a function that returns the element to render.
50
+
51
+ ### `style`
52
+ Type: `CSSProperties | ((state: DialogTriggerState) => CSSProperties | undefined) | undefined`
53
+
54
+ Style applied to the element, or a function that
55
+ returns a style object based on the component's state.
56
+
57
+ ## Examples
58
+
59
+ ```tsx
60
+ export const InThemedSubtree: Story = {
61
+ args: { defaultOpen: true },
62
+ render: (args) => (
63
+ <div className="p-4" data-theme="neon" data-scheme="dark">
64
+ <div className="bg-background p-4 text-foreground">
65
+ <Example {...args} />
66
+ </div>
67
+ </div>
68
+ ),
69
+ };
70
+ ```