cleanplate 0.1.11 → 0.2.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.
Files changed (72) hide show
  1. package/README.md +193 -60
  2. package/dist/components/accordion/Accordion.d.ts +23 -12
  3. package/dist/components/accordion/Accordion.d.ts.map +1 -1
  4. package/dist/components/accordion/index.d.ts +2 -1
  5. package/dist/components/accordion/index.d.ts.map +1 -1
  6. package/dist/components/app-shell/AppShell.d.ts +35 -3
  7. package/dist/components/app-shell/AppShell.d.ts.map +1 -1
  8. package/dist/components/app-shell/index.d.ts +2 -1
  9. package/dist/components/app-shell/index.d.ts.map +1 -1
  10. package/dist/components/bottom-sheet/BottomSheet.d.ts +17 -16
  11. package/dist/components/bottom-sheet/BottomSheet.d.ts.map +1 -1
  12. package/dist/components/bottom-sheet/index.d.ts +2 -1
  13. package/dist/components/bottom-sheet/index.d.ts.map +1 -1
  14. package/dist/components/breadcrumb/BreadCrumb.d.ts +26 -0
  15. package/dist/components/breadcrumb/BreadCrumb.d.ts.map +1 -0
  16. package/dist/components/breadcrumb/index.d.ts +3 -2
  17. package/dist/components/breadcrumb/index.d.ts.map +1 -1
  18. package/dist/components/footer/Footer.d.ts +21 -16
  19. package/dist/components/footer/Footer.d.ts.map +1 -1
  20. package/dist/components/footer/index.d.ts +2 -1
  21. package/dist/components/footer/index.d.ts.map +1 -1
  22. package/dist/components/header/Header.d.ts +32 -28
  23. package/dist/components/header/Header.d.ts.map +1 -1
  24. package/dist/components/header/index.d.ts +2 -1
  25. package/dist/components/header/index.d.ts.map +1 -1
  26. package/dist/components/icon/material-icon-names.d.ts +5 -5
  27. package/dist/components/icon/material-icon-names.d.ts.map +1 -1
  28. package/dist/components/menu-list/MenuList.d.ts +32 -22
  29. package/dist/components/menu-list/MenuList.d.ts.map +1 -1
  30. package/dist/components/menu-list/index.d.ts +2 -1
  31. package/dist/components/menu-list/index.d.ts.map +1 -1
  32. package/dist/components/page-header/PageHeader.d.ts +22 -3
  33. package/dist/components/page-header/PageHeader.d.ts.map +1 -1
  34. package/dist/components/page-header/index.d.ts +2 -1
  35. package/dist/components/page-header/index.d.ts.map +1 -1
  36. package/dist/components/toast/Toast.d.ts +20 -12
  37. package/dist/components/toast/Toast.d.ts.map +1 -1
  38. package/dist/components/toast/index.d.ts +2 -1
  39. package/dist/components/toast/index.d.ts.map +1 -1
  40. package/dist/index.css +1 -1
  41. package/dist/index.es.css +1 -1
  42. package/dist/index.es.js +3 -3
  43. package/dist/index.js +3 -3
  44. package/docs/Accordion.md +125 -0
  45. package/docs/Alert.md +131 -0
  46. package/docs/Animated.md +101 -0
  47. package/docs/AppShell.md +145 -0
  48. package/docs/Avatar.md +130 -0
  49. package/docs/Badge.md +83 -0
  50. package/docs/BottomSheet.md +78 -0
  51. package/docs/BreadCrumb.md +133 -0
  52. package/docs/Button.md +189 -0
  53. package/docs/ConfirmDialog.md +139 -0
  54. package/docs/Container.md +230 -0
  55. package/docs/Dropdown.md +175 -0
  56. package/docs/Footer.md +93 -0
  57. package/docs/FormControls.md +115 -0
  58. package/docs/Header.md +115 -0
  59. package/docs/Icon.md +225 -0
  60. package/docs/MediaObject.md +303 -0
  61. package/docs/MenuList.md +113 -0
  62. package/docs/Modal.md +152 -0
  63. package/docs/PageHeader.md +134 -0
  64. package/docs/Pagination.md +142 -0
  65. package/docs/Pills.md +104 -0
  66. package/docs/Spinner.md +115 -0
  67. package/docs/Stepper.md +131 -0
  68. package/docs/Table.md +194 -0
  69. package/docs/Toast.md +96 -0
  70. package/docs/Typography.md +231 -0
  71. package/llms.txt +293 -0
  72. package/package.json +6 -1
@@ -0,0 +1,131 @@
1
+ # Stepper Component
2
+
3
+ Purpose: Displays a sequence of steps (e.g. for a wizard or checkout). Each step has a label, optional active/completed state, and can be clickable. Use it for multi-step flows and progress indication. Supports horizontal and vertical layout.
4
+
5
+ ## Props / Inputs
6
+
7
+ | Prop | Type | Required | Default | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | variant | "horizontal" \| "vertical" | no | — | Layout direction. |
10
+ | margin | string \| string[] | no | "0" | Spacing **suffix** for outer margin. The component adds the `m-` prefix (e.g. `"0"` → m-0, `"b-2"` → m-b-2). Use a single string or array. |
11
+ | className | string | no | "" | Additional class names for the root element. |
12
+ | config | StepperStepConfig[] | yes | — | Step definitions: each has label, key, and optionally isCompleted, isActive. |
13
+ | onClick | (step: StepperStepConfig) => void | no | — | Called when a step is clicked; receives the step config. |
14
+
15
+ ## Types
16
+
17
+ ### StepperStepConfig
18
+ ```typescript
19
+ interface StepperStepConfig {
20
+ label: string; // Display label
21
+ key: string; // Unique key (e.g. href fragment or route path)
22
+ isCompleted?: boolean;
23
+ isActive?: boolean;
24
+ }
25
+ ```
26
+
27
+ ### StepperVariant
28
+ ```typescript
29
+ type StepperVariant = "horizontal" | "vertical";
30
+ ```
31
+
32
+ ### SpacingOption
33
+ ```typescript
34
+ type SpacingOption = (typeof SPACING_OPTIONS)[number];
35
+ ```
36
+
37
+ ### StepperMargin
38
+ ```typescript
39
+ type StepperMargin = string | SpacingOption[];
40
+ ```
41
+
42
+ ### StepperProps
43
+ ```typescript
44
+ interface StepperProps {
45
+ variant?: StepperVariant;
46
+ margin?: StepperMargin;
47
+ className?: string;
48
+ config: StepperStepConfig[];
49
+ onClick?: (step: StepperStepConfig) => void;
50
+ }
51
+ ```
52
+
53
+ ## Usage Examples
54
+
55
+ ### Basic
56
+
57
+ ```jsx
58
+ import { Stepper } from "cleanplate";
59
+
60
+ const config = [
61
+ { label: "Details", key: "/details", isActive: true },
62
+ { label: "Review", key: "/review", isCompleted: true },
63
+ { label: "Confirm", key: "/confirm" },
64
+ ];
65
+
66
+ export const Example = () => (
67
+ <Stepper config={config} variant="horizontal" />
68
+ );
69
+ ```
70
+
71
+ ### With onClick
72
+
73
+ ```jsx
74
+ import { Stepper } from "cleanplate";
75
+ import { useState } from "react";
76
+
77
+ const Example = () => {
78
+ const [active, setActive] = useState("step1");
79
+ const config = [
80
+ { label: "Step 1", key: "step1", isActive: active === "step1" },
81
+ { label: "Step 2", key: "step2", isActive: active === "step2" },
82
+ ];
83
+ return (
84
+ <Stepper config={config} onClick={(step) => setActive(step.key)} />
85
+ );
86
+ };
87
+ ```
88
+
89
+ ### Horizontal and vertical
90
+
91
+ ```jsx
92
+ <Stepper config={config} variant="horizontal" />
93
+ <Stepper config={config} variant="vertical" />
94
+ ```
95
+
96
+ ### With completed steps
97
+
98
+ ```jsx
99
+ <Stepper
100
+ config={[
101
+ { label: "Step 1", key: "1", isCompleted: true },
102
+ { label: "Step 2", key: "2", isCompleted: true },
103
+ { label: "Step 3", key: "3", isActive: true },
104
+ { label: "Step 4", key: "4" },
105
+ ]}
106
+ variant="horizontal"
107
+ />
108
+ ```
109
+
110
+ ### With Container
111
+
112
+ ```jsx
113
+ import { Stepper, Container } from "cleanplate";
114
+
115
+ <Container padding="4">
116
+ <Stepper config={config} variant="horizontal" margin="b-2" />
117
+ </Container>
118
+ ```
119
+
120
+ ## Behavior Notes
121
+
122
+ - **Links:** Each step label is an `<a href={step.key}>`. The component calls `preventDefault()` on click and invokes `onClick(step)` so you can control navigation (e.g. router) without following the href.
123
+ - **Completed:** When `step.isCompleted` is true, the step number is replaced with a done icon.
124
+ - **Active:** When `step.isActive` is true, the step gets the active CSS class.
125
+ - **Spacing:** `margin` accepts the **spacing suffix**; the component adds the `m-` prefix via `getSpacingClass`.
126
+
127
+ ## Related Components / Links
128
+
129
+ - Container (layout and spacing around the stepper)
130
+ - Typography (headings above or near the stepper)
131
+ - Icon (used internally for the done icon on completed steps)
package/docs/Table.md ADDED
@@ -0,0 +1,194 @@
1
+ # Table Component
2
+
3
+ Purpose: Displays structured data in a table with configurable columns, optional built-in pagination, and a responsive mobile view. Each row is an object; column `id` values match row keys for default cell rendering. Use `customRender` per column for badges, buttons, or custom content. When viewport is under 768px and `mobileColumns` is set, rows are shown as MediaObject cards instead of a table. Optional `onRowClick(rowData)` for clickable rows.
4
+
5
+ ## Props / Inputs
6
+
7
+ | Prop | Type | Required | Default | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | columns | TableColumn[] | yes | — | Column definitions (id, title, textAlign?, widthPercentage?, customRender?). |
10
+ | data | TableRow[] | yes | — | Array of row objects; keys should match column `id`s. |
11
+ | variant | "default" \| "compact" | no | "default" | Visual variant. |
12
+ | margin | string \| SpacingOption[] | no | "0" | Margin spacing. Suffix or array of spacing suffixes; component adds `m-` prefix. |
13
+ | className | string | no | "" | Additional class names for the root element. |
14
+ | onRowClick | (rowData: TableRow) => void | no | — | Called when a row is clicked; receives the row object. |
15
+ | totalItems | number | no | 0 | Total item count for built-in Pagination; 0 or omitted hides pagination. |
16
+ | totalLabel | string | no | "Items" | Label for the pagination total (e.g. "Items"). |
17
+ | currentPage | number | no | 1 | Current 1-based page (controlled). |
18
+ | rowsPerPage | number | no | 10 | Rows per page. |
19
+ | rowsPerPageOptions | PaginationRowsPerPageOption[] | no | — | Options for rows-per-page select (same shape as Pagination). |
20
+ | onPageChange | (page, rowsPerPage) => void | no | — | Called when page changes; receives (page, rowsPerPage). |
21
+ | onRowsPerPageChange | (rowsPerPage: number) => void | no | — | Called when rows per page changes. |
22
+ | hidePagination | boolean | no | false | If true, hides the built-in pagination bar even when totalItems > 0. |
23
+ | mobileColumns | TableMobileColumns \| null | no | null | When set and viewport < 768px, rows render as MediaObjects; keys map row keys to title, description, media. |
24
+
25
+ ## Types
26
+
27
+ ### SpacingOption
28
+ ```typescript
29
+ type SpacingOption = (typeof SPACING_OPTIONS)[number];
30
+ ```
31
+
32
+ ### TableVariant
33
+ ```typescript
34
+ type TableVariant = "default" | "compact";
35
+ ```
36
+
37
+ ### TableMargin
38
+ ```typescript
39
+ type TableMargin = string | SpacingOption[];
40
+ ```
41
+
42
+ ### TableColumnTextAlign
43
+ ```typescript
44
+ type TableColumnTextAlign = "left" | "center" | "right";
45
+ ```
46
+
47
+ ### TableRow
48
+ ```typescript
49
+ type TableRow = Record<string, unknown>;
50
+ ```
51
+
52
+ ### TableColumn
53
+ ```typescript
54
+ interface TableColumn {
55
+ id: string;
56
+ title: string;
57
+ textAlign?: TableColumnTextAlign;
58
+ customRender?: (rowData: TableRow, column: TableColumn) => React.ReactNode;
59
+ widthPercentage?: string;
60
+ }
61
+ ```
62
+
63
+ ### TableMobileColumns
64
+ ```typescript
65
+ interface TableMobileColumns {
66
+ title: string; // row key for MediaObject title
67
+ description?: string; // row key for description
68
+ mediaAvatar?: string; // row key for avatar value
69
+ mediaIcon?: string; // static icon name for all rows
70
+ mediaImage?: string; // static image URL
71
+ className?: string;
72
+ margin?: TableMargin;
73
+ padding?: string | SpacingOption[];
74
+ }
75
+ ```
76
+
77
+ ### TableProps
78
+ ```typescript
79
+ interface TableProps {
80
+ variant?: TableVariant;
81
+ margin?: TableMargin;
82
+ className?: string;
83
+ columns: TableColumn[];
84
+ data: TableRow[];
85
+ onRowClick?: (rowData: TableRow) => void;
86
+ totalItems?: number;
87
+ totalLabel?: string;
88
+ currentPage?: number;
89
+ rowsPerPage?: number;
90
+ rowsPerPageOptions?: PaginationRowsPerPageOption[];
91
+ onPageChange?: (page: number, rowsPerPage: number) => void;
92
+ onRowsPerPageChange?: (rowsPerPage: number) => void;
93
+ hidePagination?: boolean;
94
+ mobileColumns?: TableMobileColumns | null;
95
+ }
96
+ ```
97
+
98
+ ## Usage Examples
99
+
100
+ ### Basic
101
+
102
+ ```jsx
103
+ import { Table } from "cleanplate";
104
+
105
+ const columns = [
106
+ { id: "name", title: "Name" },
107
+ { id: "email", title: "Email" },
108
+ ];
109
+
110
+ const data = [
111
+ { name: "John Doe", email: "john@doe.com" },
112
+ { name: "Jane Doe", email: "jane@doe.com" },
113
+ ];
114
+
115
+ <Table columns={columns} data={data} />
116
+ ```
117
+
118
+ ### With pagination
119
+
120
+ ```jsx
121
+ import { Table } from "cleanplate";
122
+ import { useState } from "react";
123
+
124
+ const [currentPage, setCurrentPage] = useState(1);
125
+ const [rowsPerPage, setRowsPerPage] = useState(10);
126
+
127
+ <Table
128
+ columns={columns}
129
+ data={data}
130
+ totalItems={100}
131
+ currentPage={currentPage}
132
+ rowsPerPage={rowsPerPage}
133
+ onPageChange={(page) => setCurrentPage(page)}
134
+ onRowsPerPageChange={(rpp) => {
135
+ setRowsPerPage(rpp);
136
+ setCurrentPage(1);
137
+ }}
138
+ />
139
+ ```
140
+
141
+ ### Custom cell (customRender)
142
+
143
+ ```jsx
144
+ const columns = [
145
+ { id: "name", title: "Name", widthPercentage: "50%" },
146
+ {
147
+ id: "status",
148
+ title: "Status",
149
+ textAlign: "right",
150
+ customRender: (rowData, column) => (
151
+ <Badge label={String(rowData.status)} variant="success" />
152
+ ),
153
+ },
154
+ ];
155
+ <Table columns={columns} data={data} />;
156
+ ```
157
+
158
+ ### Mobile view (mobileColumns)
159
+
160
+ ```jsx
161
+ <Table
162
+ columns={columns}
163
+ data={data}
164
+ mobileColumns={{
165
+ title: "name",
166
+ description: "email",
167
+ mediaAvatar: "avatarUrl",
168
+ }}
169
+ />
170
+ ```
171
+
172
+ ### Row click
173
+
174
+ ```jsx
175
+ <Table
176
+ columns={columns}
177
+ data={data}
178
+ onRowClick={(rowData) => console.log(rowData)}
179
+ />
180
+ ```
181
+
182
+ ## Behavior Notes
183
+
184
+ - **Required:** `columns` and `data` are required. Each column must have `id` and `title`; row keys should match `id` for default cell display.
185
+ - **Pagination:** Built-in Pagination is shown when `totalItems` > 0 and `hidePagination` is false. Pass `onPageChange` and optionally `onRowsPerPageChange`; keep `currentPage` and `rowsPerPage` in parent state.
186
+ - **Mobile:** When viewport width < 768px and `mobileColumns` is set, the table is replaced by a list of MediaObject items; `title` (and optionally `description`, `mediaAvatar`) are row keys whose values are passed to MediaObject.
187
+ - **customRender:** Receives `(rowData, column)` and returns a React node; use for badges, buttons, or any custom cell content.
188
+ - **Spacing:** `margin` uses the suffix API; the component adds the `m-` prefix via `getSpacingClass`.
189
+
190
+ ## Related Components / Links
191
+
192
+ - Pagination (used inside Table when totalItems > 0 and hidePagination is false; same props as standalone Pagination)
193
+ - MediaObject (used for mobile view when mobileColumns is set)
194
+ - Typography, Container (used for headers and cells; Container often used in customRender with Badge)
package/docs/Toast.md ADDED
@@ -0,0 +1,96 @@
1
+ # Toast Component
2
+
3
+ Purpose: Displays transient messages in a portal (fixed top-right). Use a ref to call `addMessage({ mode, message })` imperatively. The parent does not manage toast state; the component handles rendering, stacking, and optional auto-close. Use for success/error feedback, notifications, or short-lived messages.
4
+
5
+ ## Props / Inputs
6
+
7
+ | Prop | Type | Required | Default | Description |
8
+ | --- | --- | --- | --- | --- |
9
+ | autoClose | boolean | no | false | Whether toasts auto-close after autoCloseTime. |
10
+ | autoCloseTime | number | no | 5000 | Duration in ms before auto-closing when autoClose is true. |
11
+
12
+ ## Imperative API
13
+
14
+ | Method | Signature | Description |
15
+ | --- | --- | --- |
16
+ | addMessage | (toast: ToastMessage) => void | Add a toast. toast has `mode` (info \| error \| warning \| success) and `message` (string). |
17
+
18
+ ## Types
19
+
20
+ ### ToastVariant
21
+ ```typescript
22
+ type ToastVariant = "info" | "error" | "warning" | "success";
23
+ ```
24
+
25
+ ### ToastMessage
26
+ ```typescript
27
+ interface ToastMessage {
28
+ mode: ToastVariant;
29
+ message: string;
30
+ }
31
+ ```
32
+
33
+ ### ToastRefHandle
34
+ ```typescript
35
+ interface ToastRefHandle {
36
+ addMessage: (toast: ToastMessage) => void;
37
+ }
38
+ ```
39
+
40
+ ### ToastProps
41
+ ```typescript
42
+ interface ToastProps {
43
+ autoClose?: boolean;
44
+ autoCloseTime?: number;
45
+ }
46
+ ```
47
+
48
+ ## Usage Examples
49
+
50
+ ### Basic
51
+
52
+ ```jsx
53
+ import { useRef } from "react";
54
+ import { Toast, Button } from "cleanplate";
55
+
56
+ const App = () => {
57
+ const toastRef = useRef(null);
58
+ const showToast = () => {
59
+ toastRef.current?.addMessage({ mode: "success", message: "Saved!" });
60
+ };
61
+ return (
62
+ <>
63
+ <Button onClick={showToast}>Save</Button>
64
+ <Toast ref={toastRef} />
65
+ </>
66
+ );
67
+ };
68
+ ```
69
+
70
+ ### Variants
71
+
72
+ ```jsx
73
+ toastRef.current?.addMessage({ mode: "info", message: "Info message" });
74
+ toastRef.current?.addMessage({ mode: "error", message: "Error message" });
75
+ toastRef.current?.addMessage({ mode: "warning", message: "Warning message" });
76
+ toastRef.current?.addMessage({ mode: "success", message: "Success message" });
77
+ ```
78
+
79
+ ### With auto close
80
+
81
+ ```jsx
82
+ <Toast ref={toastRef} autoClose autoCloseTime={5000} />
83
+ ```
84
+
85
+ ## Behavior Notes
86
+
87
+ - **Imperative handle:** `forwardRef` + `useImperativeHandle` expose `addMessage` on the ref. The parent never manages a toast list.
88
+ - **Portal:** Toasts render in a div prepended to `document.body`, fixed at top-right (16px).
89
+ - **Icon:** Each mode maps to an icon via `getVariantIcon` (error → "error", success → "check_circle", info → "info").
90
+ - **Click to dismiss:** Clicking a toast removes it.
91
+
92
+ ## Related Components / Links
93
+
94
+ - Alert (inline feedback; use when the message should stay in the layout)
95
+ - Button (commonly used to trigger toasts)
96
+ - Container (layout around trigger buttons)
@@ -0,0 +1,231 @@
1
+ # Typography Component
2
+
3
+ Purpose: Provides a consistent set of text styles for headings, paragraphs, and inline elements, ensuring clear hierarchy, readability, and brand-aligned communication across the interface.
4
+
5
+ **For AI / LLM:** Prefer component props over inline `style`. Use `align="center"` for text alignment (not `style={{ textAlign: "center" }}`). For spacing, use the `margin` prop with the **framework-wide spacing suffix rule** (same for all CleanPlate components): pass suffix only (e.g. `margin="b-2"`), not `style={{ marginBottom }}` and not `"m-0"` or `"m-b-2"` — the component adds the `m-` prefix. See `llms.txt` for the full spacing rule.
6
+
7
+ ## Props / Inputs
8
+
9
+ | Prop | Type | Required | Default | Description |
10
+ | --- | --- | --- | --- | --- |
11
+ | children | React.ReactNode | no | — | Text content to display. |
12
+ | variant | "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" \| "p" \| "span" \| "small" | no | "p" | HTML element type to render. Determines the semantic meaning and default styling. |
13
+ | margin | string \| string[] | no | "m-0" | Spacing **suffix** only (same rule as all components). Component adds `m-` prefix. E.g. `"0"`, `"b-2"`, `["1", "b-3"]`. Do not pass `"m-0"`. |
14
+ | className | string | no | "" | Additional class names for the root element. |
15
+ | isBold | boolean | no | false | Applies bold font weight to the text. |
16
+ | align | "left" \| "center" \| "right" | no | "left" | Text alignment within its container. |
17
+ | wordBreak | "normal" \| "all" \| "wrap" | no | "normal" | Controls how words break when text overflows. |
18
+ | ...rest | any | no | — | All other standard HTML attributes are supported and passed through to the rendered element. |
19
+
20
+ ## Types
21
+
22
+ ### TypographyVariant
23
+ ```typescript
24
+ type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "small";
25
+ ```
26
+
27
+ ### TypographyAlign
28
+ ```typescript
29
+ type TypographyAlign = "left" | "right" | "center";
30
+ ```
31
+
32
+ ### TypographyWordBreak
33
+ ```typescript
34
+ type TypographyWordBreak = "normal" | "all" | "wrap";
35
+ ```
36
+
37
+ ### TypographyMargin
38
+ ```typescript
39
+ type TypographyMargin = string | SpacingOption[];
40
+ ```
41
+
42
+ ### SpacingOption
43
+ ```typescript
44
+ type SpacingOption = typeof SPACING_OPTIONS[number];
45
+ ```
46
+
47
+ ### TypographyProps
48
+ ```typescript
49
+ interface TypographyProps {
50
+ children?: React.ReactNode;
51
+ variant?: TypographyVariant;
52
+ margin?: TypographyMargin;
53
+ className?: string;
54
+ isBold?: boolean;
55
+ align?: TypographyAlign;
56
+ wordBreak?: TypographyWordBreak;
57
+ [key: string]: any; // Allow other HTML attributes to be passed through
58
+ }
59
+ ```
60
+
61
+ ## Usage Examples
62
+
63
+ ### Headings
64
+
65
+ ```jsx
66
+ import { Typography } from "cleanplate";
67
+
68
+ export const Example = () => (
69
+ <>
70
+ <Typography variant="h1">Heading 1</Typography>
71
+ <Typography variant="h2">Heading 2</Typography>
72
+ <Typography variant="h3">Heading 3</Typography>
73
+ <Typography variant="h4">Heading 4</Typography>
74
+ <Typography variant="h5">Heading 5</Typography>
75
+ <Typography variant="h6">Heading 6</Typography>
76
+ </>
77
+ );
78
+ ```
79
+
80
+ ### Paragraph (default)
81
+
82
+ ```jsx
83
+ import { Typography } from "cleanplate";
84
+
85
+ export const Example = () => (
86
+ <Typography>
87
+ This is a paragraph. When no variant is specified, it defaults to a paragraph element.
88
+ </Typography>
89
+ );
90
+ ```
91
+
92
+ ### Small text
93
+
94
+ ```jsx
95
+ import { Typography } from "cleanplate";
96
+
97
+ export const Example = () => (
98
+ <Typography variant="small">
99
+ This is small text, typically used for captions or fine print.
100
+ </Typography>
101
+ );
102
+ ```
103
+
104
+ ### Inline span
105
+
106
+ ```jsx
107
+ import { Typography } from "cleanplate";
108
+
109
+ export const Example = () => (
110
+ <Typography variant="span">
111
+ This text is rendered as an inline span element.
112
+ </Typography>
113
+ );
114
+ ```
115
+
116
+ ### Text alignment
117
+
118
+ ```jsx
119
+ import { Typography } from "cleanplate";
120
+
121
+ export const Example = () => (
122
+ <>
123
+ <Typography align="left">Left aligned text</Typography>
124
+ <Typography align="center">Center aligned text</Typography>
125
+ <Typography align="right">Right aligned text</Typography>
126
+ </>
127
+ );
128
+ ```
129
+
130
+ ### Bold text
131
+
132
+ ```jsx
133
+ import { Typography } from "cleanplate";
134
+
135
+ export const Example = () => (
136
+ <>
137
+ <Typography>Normal weight text</Typography>
138
+ <Typography isBold>Bold text</Typography>
139
+ </>
140
+ );
141
+ ```
142
+
143
+ ### Word breaking
144
+
145
+ ```jsx
146
+ import { Typography } from "cleanplate";
147
+
148
+ export const Example = () => (
149
+ <>
150
+ <Typography wordBreak="normal">
151
+ Normal word breaking behavior
152
+ </Typography>
153
+ <Typography wordBreak="all">
154
+ Break words at any point if needed
155
+ </Typography>
156
+ <Typography wordBreak="wrap">
157
+ Wrap text with word breaking
158
+ </Typography>
159
+ </>
160
+ );
161
+ ```
162
+
163
+ ### With margin spacing (suffix only)
164
+
165
+ Use the spacing **suffix**; the component adds the `m-` prefix. E.g. `"2"` → m-2, `"b-2"` → m-b-2.
166
+
167
+ ```jsx
168
+ import { Typography } from "cleanplate";
169
+
170
+ export const Example = () => (
171
+ <>
172
+ <Typography variant="h1" margin="2">
173
+ Heading with margin
174
+ </Typography>
175
+ <Typography margin={["1", "b-3"]}>
176
+ Paragraph with multiple margins
177
+ </Typography>
178
+ </>
179
+ );
180
+ ```
181
+
182
+ ### Combined properties (prefer props over style)
183
+
184
+ ```jsx
185
+ import { Typography } from "cleanplate";
186
+
187
+ export const Example = () => (
188
+ <Typography
189
+ variant="h2"
190
+ isBold
191
+ align="center"
192
+ margin="4"
193
+ >
194
+ Centered, bold heading with margin
195
+ </Typography>
196
+ );
197
+ ```
198
+
199
+ ### With HTML attributes
200
+
201
+ ```jsx
202
+ import { Typography } from "cleanplate";
203
+
204
+ export const Example = () => (
205
+ <Typography
206
+ variant="p"
207
+ id="description"
208
+ data-testid="typography-description"
209
+ aria-label="Product description"
210
+ >
211
+ This paragraph has additional HTML attributes.
212
+ </Typography>
213
+ );
214
+ ```
215
+
216
+ ## Behavior Notes
217
+
218
+ - When no `variant` is specified, the component defaults to rendering a `<p>` (paragraph) element.
219
+ - The `variant` prop determines both the HTML element type (h1, h2, p, etc.) and the default styling applied.
220
+ - The component uses semantic HTML elements, which is important for accessibility and SEO.
221
+ - All standard HTML attributes can be passed through via the spread operator (`...rest`), allowing for custom `id`, `data-*`, `aria-*`, and other attributes.
222
+ - **Use props, not inline style:** Use `align` for text alignment (e.g. `align="center"`), and `margin` for spacing. Do not use `style={{ textAlign, marginBottom }}` for these.
223
+ - The `align` prop controls text alignment using CSS classes. Values: `"left"`, `"center"`, `"right"`.
224
+ - The `wordBreak` prop provides control over how text wraps when it exceeds container width.
225
+ - **Margin uses the framework-wide spacing rule (all components):** Pass suffix only: `"0"`, `"2"`, `"b-2"`, `["1", "b-3"]` etc. The component adds the `m-` prefix. Do not pass `"m-2"` or `"m-b-2"`.
226
+ - The `isBold` prop applies bold font weight, which can be combined with any variant.
227
+
228
+ ## Related Components / Links
229
+
230
+ - Container (often used to wrap typography content)
231
+ - MediaObject (commonly uses Typography for text content)