@neynar/ui 0.3.1 → 0.4.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.
- package/.llm/blockquote.llm.md +13 -75
- package/.llm/body-text-large.llm.md +49 -0
- package/.llm/body-text-small.llm.md +49 -0
- package/.llm/body-text.llm.md +52 -0
- package/.llm/caption.llm.md +48 -0
- package/.llm/code.llm.md +11 -69
- package/.llm/overline.llm.md +51 -0
- package/.llm/page-title.llm.md +52 -0
- package/.llm/sdk-items-registry.json +46 -84
- package/.llm/section-title.llm.md +48 -0
- package/.llm/subsection-title.llm.md +46 -0
- package/dist/components/ui/stories/typography.stories.d.ts +8 -108
- package/dist/components/ui/stories/typography.stories.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +211 -474
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +133 -184
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/ui/stories/typography.stories.tsx +261 -1512
- package/src/components/ui/typography.tsx +416 -1136
- package/src/styles/globals.css +0 -21
- package/.llm/a.llm.md +0 -131
- package/.llm/h1.llm.md +0 -108
- package/.llm/h2.llm.md +0 -108
- package/.llm/h3.llm.md +0 -106
- package/.llm/h4.llm.md +0 -104
- package/.llm/h5.llm.md +0 -105
- package/.llm/h6.llm.md +0 -105
- package/.llm/lead.llm.md +0 -114
- package/.llm/p.llm.md +0 -110
- package/.llm/small.llm.md +0 -110
- package/.llm/span.llm.md +0 -118
- package/.llm/strong.llm.md +0 -110
- package/.llm/toast.llm.md +0 -32
- package/.llm/typography.llm.md +0 -161
|
@@ -1,1248 +1,572 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
2
|
|
|
5
3
|
import { cn } from "@/lib/utils";
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
* Typography
|
|
6
|
+
* Typography Components - Purpose-named, Tailwind-first text components
|
|
9
7
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* This module provides semantic typography components for web applications.
|
|
9
|
+
* Each component has a clear purpose and sensible Tailwind CSS defaults that
|
|
10
|
+
* can be fully overridden via the className prop.
|
|
13
11
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @variant subHeadline - Secondary headings for subsections (text-2xl)
|
|
21
|
-
* @variant headline - Primary headings for page/section titles (text-3xl)
|
|
22
|
-
* @variant sectionTitle - Section titles (text-4xl, leading-relaxed)
|
|
23
|
-
* @variant pageTitle - Page titles (text-5xl, leading-relaxed)
|
|
24
|
-
* @variant displayTitle - Display titles (text-6xl, leading-snug)
|
|
25
|
-
* @variant heroTitle - Hero titles (text-7xl, leading-snug)
|
|
26
|
-
* @variant code - Monospace font for inline code, terminal commands, and technical references (text-base, font-mono)
|
|
12
|
+
* Design Philosophy:
|
|
13
|
+
* - Purpose-obvious naming (PageTitle, BodyText, Caption)
|
|
14
|
+
* - Semantic HTML defaults (h1, h2, p, etc.)
|
|
15
|
+
* - Tailwind-first with zero abstraction
|
|
16
|
+
* - Full className override control
|
|
17
|
+
* - Appropriate sizing for web apps (not marketing sites)
|
|
27
18
|
*
|
|
28
|
-
* @see {@link https://
|
|
29
|
-
* @
|
|
30
|
-
* @since 1.0.0
|
|
19
|
+
* @see {@link https://tailwindcss.com} Tailwind CSS documentation
|
|
20
|
+
* @since 2.0.0
|
|
31
21
|
*/
|
|
32
|
-
const typographyVariants = cva("", {
|
|
33
|
-
variants: {
|
|
34
|
-
variant: {
|
|
35
|
-
microcopy: "text-xs",
|
|
36
|
-
detail: "text-sm",
|
|
37
|
-
body: "text-base leading-snug",
|
|
38
|
-
blogBody: "text-lg leading-loose",
|
|
39
|
-
paragraphLead: "text-lg",
|
|
40
|
-
eyebrow: "text-xl",
|
|
41
|
-
subHeadline: "text-2xl",
|
|
42
|
-
headline: "text-3xl",
|
|
43
|
-
sectionTitle: "text-4xl leading-relaxed",
|
|
44
|
-
pageTitle: "text-5xl leading-relaxed",
|
|
45
|
-
displayTitle: "text-6xl leading-snug",
|
|
46
|
-
heroTitle: "text-7xl leading-snug",
|
|
47
|
-
code: "text-base font-mono",
|
|
48
|
-
},
|
|
49
|
-
/**
|
|
50
|
-
* Color variants for different semantic meanings and visual hierarchy
|
|
51
|
-
*
|
|
52
|
-
* @variant default - Default text color that adapts to light/dark theme (text-foreground)
|
|
53
|
-
* @variant muted - Subdued text color for secondary information and descriptions (text-muted-foreground)
|
|
54
|
-
* @variant faint - Very subtle text color for minimal visual prominence (text-neynar-faint-foreground)
|
|
55
|
-
* @variant accent - Accent color for emphasis, highlights, and interactive elements (text-accent-foreground)
|
|
56
|
-
* @variant destructive - Red color for error messages, warnings, and destructive actions (text-destructive)
|
|
57
|
-
* @variant success - Green color for success messages, confirmations, and positive states (text-success)
|
|
58
|
-
* @variant warning - Orange/yellow color for warnings, cautions, and attention-seeking content (text-warning)
|
|
59
|
-
*/
|
|
60
|
-
color: {
|
|
61
|
-
default: "text-foreground",
|
|
62
|
-
muted: "text-muted-foreground",
|
|
63
|
-
faint: "text-neynar-faint-foreground",
|
|
64
|
-
accent: "text-accent-foreground",
|
|
65
|
-
destructive: "text-destructive",
|
|
66
|
-
success: "text-success",
|
|
67
|
-
warning: "text-warning",
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Text alignment options for layout control
|
|
71
|
-
*
|
|
72
|
-
* @variant left - Left-aligned text (default for LTR languages)
|
|
73
|
-
* @variant center - Center-aligned text for headings and callouts
|
|
74
|
-
* @variant right - Right-aligned text for numerical data and RTL content
|
|
75
|
-
* @variant justify - Justified text for formal documents and articles
|
|
76
|
-
*/
|
|
77
|
-
align: {
|
|
78
|
-
left: "text-left",
|
|
79
|
-
center: "text-center",
|
|
80
|
-
right: "text-right",
|
|
81
|
-
justify: "text-justify",
|
|
82
|
-
},
|
|
83
|
-
/**
|
|
84
|
-
* Text transformation options for stylistic effects
|
|
85
|
-
*
|
|
86
|
-
* @variant uppercase - ALL CAPS for emphasis and labels
|
|
87
|
-
* @variant lowercase - all lowercase for stylistic consistency
|
|
88
|
-
* @variant capitalize - Title Case For Headings And Proper Nouns
|
|
89
|
-
*/
|
|
90
|
-
transform: {
|
|
91
|
-
uppercase: "uppercase",
|
|
92
|
-
lowercase: "lowercase",
|
|
93
|
-
capitalize: "capitalize",
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* Font weight variations for visual hierarchy
|
|
97
|
-
*
|
|
98
|
-
* @variant normal - Normal font weight (400) for body text
|
|
99
|
-
* @variant medium - Medium font weight (500) for subtle emphasis
|
|
100
|
-
* @variant semibold - Semibold font weight (600) for headings and important text
|
|
101
|
-
* @variant bold - Bold font weight (700) for strong emphasis
|
|
102
|
-
*/
|
|
103
|
-
weight: {
|
|
104
|
-
normal: "font-normal",
|
|
105
|
-
medium: "font-medium",
|
|
106
|
-
semibold: "font-semibold",
|
|
107
|
-
bold: "font-bold",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
defaultVariants: {
|
|
111
|
-
variant: "body",
|
|
112
|
-
color: "default",
|
|
113
|
-
align: "left",
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
22
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
| "heroTitle"
|
|
130
|
-
| "code";
|
|
131
|
-
|
|
132
|
-
type TypographyColor =
|
|
133
|
-
| "default"
|
|
134
|
-
| "muted"
|
|
135
|
-
| "faint"
|
|
136
|
-
| "accent"
|
|
137
|
-
| "destructive"
|
|
138
|
-
| "success"
|
|
139
|
-
| "warning";
|
|
140
|
-
|
|
141
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
142
|
-
type TypographyDocsProps = {
|
|
143
|
-
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
144
|
-
variant?: TypographyVariant;
|
|
145
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
146
|
-
color?: TypographyColor;
|
|
147
|
-
/** Text alignment within the container @default "left" */
|
|
148
|
-
align?: "left" | "center" | "right" | "justify";
|
|
149
|
-
/** Text transformation for stylistic effects */
|
|
150
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
151
|
-
/** Font weight override for visual emphasis */
|
|
152
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
153
|
-
/** The HTML element or component to render as @default "p" */
|
|
154
|
-
as?: React.ElementType;
|
|
155
|
-
/** For label elements, the associated input ID for accessibility */
|
|
156
|
-
htmlFor?: string;
|
|
157
|
-
/** Whether to render as a Slot component for composition patterns. When true, the component merges its props onto its immediate child instead of rendering its own DOM element @default false */
|
|
158
|
-
asChild?: boolean;
|
|
159
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
160
|
-
italic?: boolean;
|
|
161
|
-
/** Whether the text should have underline decoration @default false */
|
|
162
|
-
underline?: boolean;
|
|
163
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
164
|
-
strikethrough?: boolean;
|
|
165
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
166
|
-
truncate?: boolean;
|
|
167
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
168
|
-
srOnly?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Base typography component props
|
|
25
|
+
*
|
|
26
|
+
* All typography components accept these props:
|
|
27
|
+
* - `as` - The HTML element to render (each component has a sensible default)
|
|
28
|
+
* - `className` - Additional Tailwind classes to merge with defaults
|
|
29
|
+
* - `children` - Content to render
|
|
30
|
+
* - All standard HTML attributes for the underlying element
|
|
31
|
+
*/
|
|
32
|
+
type TypographyBaseProps<T extends React.ElementType> = {
|
|
33
|
+
/** The HTML element or component to render as */
|
|
34
|
+
as?: T;
|
|
169
35
|
/** Additional CSS classes for custom styling */
|
|
170
36
|
className?: string;
|
|
171
37
|
/** Content to render within the typography element */
|
|
172
38
|
children?: React.ReactNode;
|
|
173
|
-
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type TypographyProps<T extends React.ElementType> = TypographyBaseProps<T> &
|
|
42
|
+
Omit<React.ComponentPropsWithoutRef<T>, keyof TypographyBaseProps<T>>;
|
|
174
43
|
|
|
175
44
|
/**
|
|
176
|
-
*
|
|
45
|
+
* Props for PageTitle (Documentation only - NOT used in component implementation)
|
|
177
46
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
/** Color variant for semantic meaning and visual hierarchy */
|
|
182
|
-
color?: TypographyColor;
|
|
183
|
-
/** Text alignment within the container */
|
|
184
|
-
align?: VariantProps<typeof typographyVariants>["align"];
|
|
185
|
-
/** Text transformation for stylistic effects */
|
|
186
|
-
transform?: VariantProps<typeof typographyVariants>["transform"];
|
|
187
|
-
/** Font weight override for visual emphasis */
|
|
188
|
-
weight?: VariantProps<typeof typographyVariants>["weight"];
|
|
189
|
-
/** The HTML element or component to render as @default "p" */
|
|
47
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
48
|
+
type PageTitleDocsProps = {
|
|
49
|
+
/** The HTML element to render @default "h1" */
|
|
190
50
|
as?: React.ElementType;
|
|
191
|
-
/**
|
|
192
|
-
htmlFor?: string;
|
|
193
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
194
|
-
asChild?: boolean;
|
|
195
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
196
|
-
italic?: boolean;
|
|
197
|
-
/** Whether the text should have underline decoration @default false */
|
|
198
|
-
underline?: boolean;
|
|
199
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
200
|
-
strikethrough?: boolean;
|
|
201
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
202
|
-
truncate?: boolean;
|
|
203
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
204
|
-
srOnly?: boolean;
|
|
205
|
-
/** Additional CSS classes for custom styling */
|
|
51
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
206
52
|
className?: string;
|
|
207
|
-
/** Content to render within the
|
|
53
|
+
/** Content to render within the page title */
|
|
208
54
|
children?: React.ReactNode;
|
|
209
|
-
}
|
|
55
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
210
56
|
|
|
211
57
|
/**
|
|
212
|
-
*
|
|
58
|
+
* Props for SectionTitle (Documentation only - NOT used in component implementation)
|
|
213
59
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
60
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
61
|
+
type SectionTitleDocsProps = {
|
|
62
|
+
/** The HTML element to render @default "h2" */
|
|
63
|
+
as?: React.ElementType;
|
|
64
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
65
|
+
className?: string;
|
|
66
|
+
/** Content to render within the section title */
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
216
69
|
|
|
217
70
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* A flexible typography component that provides semantic text variants, color options, and accessibility features.
|
|
221
|
-
* Built with class-variance-authority (CVA) for type-safe variant management and supports both semantic HTML
|
|
222
|
-
* elements and composition patterns via Radix UI Slot. Designed to handle all text styling needs across
|
|
223
|
-
* the application with consistent visual hierarchy and accessibility compliance.
|
|
224
|
-
*
|
|
225
|
-
* @example
|
|
226
|
-
* ```tsx
|
|
227
|
-
* // Basic heading with semantic HTML
|
|
228
|
-
* <Typography variant="heading" as="h1">
|
|
229
|
-
* Welcome to Neynar
|
|
230
|
-
* </Typography>
|
|
231
|
-
*
|
|
232
|
-
* // Body text with color variant
|
|
233
|
-
* <Typography variant="body" color="muted">
|
|
234
|
-
* This is secondary body text with reduced visual prominence.
|
|
235
|
-
* </Typography>
|
|
236
|
-
*
|
|
237
|
-
* // Code snippet with proper semantics
|
|
238
|
-
* <Typography variant="code" as="code">
|
|
239
|
-
* const message = "Hello, world!";
|
|
240
|
-
* </Typography>
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```tsx
|
|
245
|
-
* // Advanced styling with multiple variants
|
|
246
|
-
* <Typography
|
|
247
|
-
* variant="subheading"
|
|
248
|
-
* color="accent"
|
|
249
|
-
* align="center"
|
|
250
|
-
* weight="semibold"
|
|
251
|
-
* italic
|
|
252
|
-
* underline
|
|
253
|
-
* className="mb-4"
|
|
254
|
-
* >
|
|
255
|
-
* Styled Subheading with Multiple Variants
|
|
256
|
-
* </Typography>
|
|
257
|
-
*
|
|
258
|
-
* // Truncated text for constrained layouts
|
|
259
|
-
* <Typography variant="body" truncate className="max-w-xs">
|
|
260
|
-
* This is a very long text that will be truncated with ellipsis when it exceeds the container width
|
|
261
|
-
* </Typography>
|
|
262
|
-
* ```
|
|
263
|
-
*
|
|
264
|
-
* @example
|
|
265
|
-
* ```tsx
|
|
266
|
-
* // Accessibility features
|
|
267
|
-
* <Typography variant="details" srOnly>
|
|
268
|
-
* Additional context for screen readers only
|
|
269
|
-
* </Typography>
|
|
270
|
-
*
|
|
271
|
-
* // Form label with proper association
|
|
272
|
-
* <Typography variant="field" as="label" htmlFor="email-input">
|
|
273
|
-
* Email Address
|
|
274
|
-
* </Typography>
|
|
275
|
-
*
|
|
276
|
-
* // Composition with asChild for complex structures
|
|
277
|
-
* <Typography variant="body" asChild>
|
|
278
|
-
* <a href="/about" className="hover:underline">
|
|
279
|
-
* Learn more about our platform
|
|
280
|
-
* </a>
|
|
281
|
-
* </Typography>
|
|
282
|
-
* ```
|
|
283
|
-
*
|
|
284
|
-
* @accessibility
|
|
285
|
-
* - **Semantic HTML**: Uses appropriate HTML elements via `as` prop for proper document structure
|
|
286
|
-
* - **Screen Reader Support**: `srOnly` prop provides content accessible only to assistive technologies
|
|
287
|
-
* - **Color Contrast**: All color variants meet WCAG 2.1 AA contrast requirements (4.5:1 minimum)
|
|
288
|
-
* - **Label Association**: `htmlFor` prop properly associates labels with form controls
|
|
289
|
-
* - **Focus Management**: Interactive elements receive proper focus indicators
|
|
290
|
-
* - **Text Scaling**: All font sizes scale appropriately with user's browser text size preferences
|
|
291
|
-
* - **High Contrast Mode**: Respects system high contrast mode preferences
|
|
292
|
-
*
|
|
293
|
-
* @performance
|
|
294
|
-
* - Uses CVA for efficient class generation and tree-shaking
|
|
295
|
-
* - Minimal runtime overhead with compile-time optimizations
|
|
296
|
-
* - Cached class combinations for repeated variant usage
|
|
297
|
-
*
|
|
298
|
-
* @see {@link H1} Semantic H1 heading component
|
|
299
|
-
* @see {@link H2} Semantic H2 heading component
|
|
300
|
-
* @see {@link P} Semantic paragraph component
|
|
301
|
-
* @see {@link Code} Semantic code element component
|
|
302
|
-
* @see {@link https://cva.style/docs} Class Variance Authority documentation
|
|
303
|
-
* @see {@link https://ui.shadcn.com/docs/components/typography} shadcn/ui Typography reference
|
|
304
|
-
* @since 1.0.0
|
|
71
|
+
* Props for SubsectionTitle (Documentation only - NOT used in component implementation)
|
|
305
72
|
*/
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
italic = false,
|
|
316
|
-
underline = false,
|
|
317
|
-
strikethrough = false,
|
|
318
|
-
truncate = false,
|
|
319
|
-
srOnly = false,
|
|
320
|
-
...props
|
|
321
|
-
}: TypographyProps) {
|
|
322
|
-
const Comp = asChild ? Slot : Element;
|
|
323
|
-
|
|
324
|
-
return (
|
|
325
|
-
<Comp
|
|
326
|
-
data-slot="typography"
|
|
327
|
-
className={cn(
|
|
328
|
-
typographyVariants({ variant, color, align, transform, weight }),
|
|
329
|
-
{
|
|
330
|
-
italic,
|
|
331
|
-
underline,
|
|
332
|
-
"line-through": strikethrough,
|
|
333
|
-
"truncate overflow-hidden text-ellipsis whitespace-nowrap": truncate,
|
|
334
|
-
"sr-only": srOnly,
|
|
335
|
-
},
|
|
336
|
-
className,
|
|
337
|
-
)}
|
|
338
|
-
{...props}
|
|
339
|
-
/>
|
|
340
|
-
);
|
|
341
|
-
}
|
|
73
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
74
|
+
type SubsectionTitleDocsProps = {
|
|
75
|
+
/** The HTML element to render @default "h3" */
|
|
76
|
+
as?: React.ElementType;
|
|
77
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Content to render within the subsection title */
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
342
82
|
|
|
343
83
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* These components provide semantic HTML elements with pre-configured typography variants,
|
|
347
|
-
* ensuring consistent styling while maintaining proper document structure and accessibility.
|
|
348
|
-
* Each component uses the appropriate HTML element and typography variant for its semantic meaning.
|
|
84
|
+
* Props for BodyText (Documentation only - NOT used in component implementation)
|
|
349
85
|
*/
|
|
350
|
-
|
|
351
86
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
352
|
-
type
|
|
353
|
-
/**
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
align?: "left" | "center" | "right" | "justify";
|
|
357
|
-
/** Text transformation for stylistic effects */
|
|
358
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
359
|
-
/** Font weight override for visual emphasis */
|
|
360
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
361
|
-
/** For label elements, the associated input ID for accessibility */
|
|
362
|
-
htmlFor?: string;
|
|
363
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
364
|
-
asChild?: boolean;
|
|
365
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
366
|
-
italic?: boolean;
|
|
367
|
-
/** Whether the text should have underline decoration @default false */
|
|
368
|
-
underline?: boolean;
|
|
369
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
370
|
-
strikethrough?: boolean;
|
|
371
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
372
|
-
truncate?: boolean;
|
|
373
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
374
|
-
srOnly?: boolean;
|
|
375
|
-
/** Additional CSS classes for custom styling */
|
|
87
|
+
type BodyTextDocsProps = {
|
|
88
|
+
/** The HTML element to render @default "p" */
|
|
89
|
+
as?: React.ElementType;
|
|
90
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
376
91
|
className?: string;
|
|
377
|
-
/** Content to render within the
|
|
92
|
+
/** Content to render within the body text */
|
|
378
93
|
children?: React.ReactNode;
|
|
379
|
-
} & React.HTMLAttributes<
|
|
380
|
-
|
|
381
|
-
/** Props for H1 heading component */
|
|
382
|
-
type H1Props = Omit<TypographyProps, "as">;
|
|
94
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
383
95
|
|
|
384
96
|
/**
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
* The main heading for a page or major section. Uses the "displayTitle" variant with h1 semantic element.
|
|
388
|
-
* Should be used once per page for proper document outline and SEO.
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* ```tsx
|
|
392
|
-
* // Page title
|
|
393
|
-
* <H1>Welcome to Neynar Platform</H1>
|
|
394
|
-
*
|
|
395
|
-
* // With color variant
|
|
396
|
-
* <H1 color="muted">Draft: Article Title</H1>
|
|
397
|
-
*
|
|
398
|
-
* // With custom styling
|
|
399
|
-
* <H1 align="center" className="mb-8">
|
|
400
|
-
* Centered Page Heading
|
|
401
|
-
* </H1>
|
|
402
|
-
* ```
|
|
403
|
-
*
|
|
404
|
-
* @accessibility
|
|
405
|
-
* - Creates proper document outline structure
|
|
406
|
-
* - Should be the first heading on the page
|
|
407
|
-
* - Provides main page topic for screen readers
|
|
408
|
-
* - Helps with keyboard navigation landmarks
|
|
409
|
-
*
|
|
410
|
-
* @see {@link H2} Secondary heading component
|
|
411
|
-
* @see {@link Typography} Base typography component
|
|
97
|
+
* Props for BodyTextLarge (Documentation only - NOT used in component implementation)
|
|
412
98
|
*/
|
|
413
|
-
function H1({ variant = "displayTitle", weight = "bold", ...props }: H1Props) {
|
|
414
|
-
return <Typography variant={variant} weight={weight} as="h1" {...props} />;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
99
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
418
|
-
type
|
|
419
|
-
/**
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
align?: "left" | "center" | "right" | "justify";
|
|
423
|
-
/** Text transformation for stylistic effects */
|
|
424
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
425
|
-
/** Font weight override for visual emphasis */
|
|
426
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
427
|
-
/** For label elements, the associated input ID for accessibility */
|
|
428
|
-
htmlFor?: string;
|
|
429
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
430
|
-
asChild?: boolean;
|
|
431
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
432
|
-
italic?: boolean;
|
|
433
|
-
/** Whether the text should have underline decoration @default false */
|
|
434
|
-
underline?: boolean;
|
|
435
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
436
|
-
strikethrough?: boolean;
|
|
437
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
438
|
-
truncate?: boolean;
|
|
439
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
440
|
-
srOnly?: boolean;
|
|
441
|
-
/** Additional CSS classes for custom styling */
|
|
100
|
+
type BodyTextLargeDocsProps = {
|
|
101
|
+
/** The HTML element to render @default "p" */
|
|
102
|
+
as?: React.ElementType;
|
|
103
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
442
104
|
className?: string;
|
|
443
|
-
/** Content to render within the
|
|
105
|
+
/** Content to render within the large body text */
|
|
444
106
|
children?: React.ReactNode;
|
|
445
|
-
} & React.HTMLAttributes<
|
|
446
|
-
|
|
447
|
-
/** Props for H2 heading component */
|
|
448
|
-
type H2Props = Omit<TypographyProps, "as">;
|
|
107
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
449
108
|
|
|
450
109
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* Section headings that divide page content into logical groups. Uses the "sectionTitle" variant
|
|
454
|
-
* with h2 semantic element. Essential for creating proper document hierarchy.
|
|
455
|
-
*
|
|
456
|
-
* @example
|
|
457
|
-
* ```tsx
|
|
458
|
-
* // Section heading
|
|
459
|
-
* <H2>Getting Started</H2>
|
|
460
|
-
*
|
|
461
|
-
* // With accent color
|
|
462
|
-
* <H2 color="accent">Featured Content</H2>
|
|
463
|
-
*
|
|
464
|
-
* // With additional styling
|
|
465
|
-
* <H2 weight="bold" className="border-b pb-2">
|
|
466
|
-
* Section with Border
|
|
467
|
-
* </H2>
|
|
468
|
-
* ```
|
|
469
|
-
*
|
|
470
|
-
* @accessibility
|
|
471
|
-
* - Maintains document outline hierarchy
|
|
472
|
-
* - Should follow H1 and precede H3 elements
|
|
473
|
-
* - Provides section navigation for screen readers
|
|
474
|
-
* - Essential for skip navigation functionality
|
|
475
|
-
*
|
|
476
|
-
* @see {@link H1} Primary heading component
|
|
477
|
-
* @see {@link H3} Tertiary heading component
|
|
110
|
+
* Props for BodyTextSmall (Documentation only - NOT used in component implementation)
|
|
478
111
|
*/
|
|
479
|
-
function H2({ variant = "sectionTitle", weight = "bold", ...props }: H2Props) {
|
|
480
|
-
return <Typography variant={variant} weight={weight} as="h2" {...props} />;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
112
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
484
|
-
type
|
|
485
|
-
/**
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
align?: "left" | "center" | "right" | "justify";
|
|
489
|
-
/** Text transformation for stylistic effects */
|
|
490
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
491
|
-
/** Font weight override for visual emphasis */
|
|
492
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
493
|
-
/** For label elements, the associated input ID for accessibility */
|
|
494
|
-
htmlFor?: string;
|
|
495
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
496
|
-
asChild?: boolean;
|
|
497
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
498
|
-
italic?: boolean;
|
|
499
|
-
/** Whether the text should have underline decoration @default false */
|
|
500
|
-
underline?: boolean;
|
|
501
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
502
|
-
strikethrough?: boolean;
|
|
503
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
504
|
-
truncate?: boolean;
|
|
505
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
506
|
-
srOnly?: boolean;
|
|
507
|
-
/** Additional CSS classes for custom styling */
|
|
113
|
+
type BodyTextSmallDocsProps = {
|
|
114
|
+
/** The HTML element to render @default "p" */
|
|
115
|
+
as?: React.ElementType;
|
|
116
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
508
117
|
className?: string;
|
|
509
|
-
/** Content to render within the
|
|
118
|
+
/** Content to render within the small body text */
|
|
510
119
|
children?: React.ReactNode;
|
|
511
|
-
} & React.HTMLAttributes<
|
|
512
|
-
|
|
513
|
-
/** Props for H3 heading component */
|
|
514
|
-
type H3Props = Omit<TypographyProps, "as">;
|
|
120
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
515
121
|
|
|
516
122
|
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
* Subsection headings for further content division. Uses the "headline" variant
|
|
520
|
-
* with h3 semantic element for consistent visual hierarchy.
|
|
521
|
-
*
|
|
522
|
-
* @example
|
|
523
|
-
* ```tsx
|
|
524
|
-
* // Subsection heading
|
|
525
|
-
* <H3>Installation Guide</H3>
|
|
526
|
-
*
|
|
527
|
-
* // In a card or content block
|
|
528
|
-
* <H3 color="muted" className="mb-3">
|
|
529
|
-
* Optional Configuration
|
|
530
|
-
* </H3>
|
|
531
|
-
* ```
|
|
532
|
-
*
|
|
533
|
-
* @accessibility
|
|
534
|
-
* - Should follow H2 elements in document flow
|
|
535
|
-
* - Helps create detailed content structure
|
|
536
|
-
* - Improves navigation with assistive technologies
|
|
537
|
-
* - Supports table of contents generation
|
|
123
|
+
* Props for Caption (Documentation only - NOT used in component implementation)
|
|
538
124
|
*/
|
|
539
|
-
function H3({ variant = "headline", weight = "bold", ...props }: H3Props) {
|
|
540
|
-
return <Typography variant={variant} weight={weight} as="h3" {...props} />;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
125
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
544
|
-
type
|
|
545
|
-
/**
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
align?: "left" | "center" | "right" | "justify";
|
|
549
|
-
/** Text transformation for stylistic effects */
|
|
550
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
551
|
-
/** Font weight override for visual emphasis */
|
|
552
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
553
|
-
/** For label elements, the associated input ID for accessibility */
|
|
554
|
-
htmlFor?: string;
|
|
555
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
556
|
-
asChild?: boolean;
|
|
557
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
558
|
-
italic?: boolean;
|
|
559
|
-
/** Whether the text should have underline decoration @default false */
|
|
560
|
-
underline?: boolean;
|
|
561
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
562
|
-
strikethrough?: boolean;
|
|
563
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
564
|
-
truncate?: boolean;
|
|
565
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
566
|
-
srOnly?: boolean;
|
|
567
|
-
/** Additional CSS classes for custom styling */
|
|
126
|
+
type CaptionDocsProps = {
|
|
127
|
+
/** The HTML element to render @default "span" */
|
|
128
|
+
as?: React.ElementType;
|
|
129
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
568
130
|
className?: string;
|
|
569
|
-
/** Content to render within the
|
|
131
|
+
/** Content to render within the caption */
|
|
570
132
|
children?: React.ReactNode;
|
|
571
|
-
} & React.HTMLAttributes<
|
|
572
|
-
|
|
573
|
-
/** Props for H4 heading component */
|
|
574
|
-
type H4Props = Omit<TypographyProps, "as">;
|
|
133
|
+
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
575
134
|
|
|
576
135
|
/**
|
|
577
|
-
*
|
|
578
|
-
*
|
|
579
|
-
* Minor headings for detailed content organization. Uses "subHeadline" variant
|
|
580
|
-
* with h4 semantic element for subtle but distinct hierarchy.
|
|
581
|
-
*
|
|
582
|
-
* @example
|
|
583
|
-
* ```tsx
|
|
584
|
-
* // Minor section heading
|
|
585
|
-
* <H4>Configuration Options</H4>
|
|
586
|
-
*
|
|
587
|
-
* // In detailed documentation
|
|
588
|
-
* <H4 color="muted">Advanced Settings</H4>
|
|
589
|
-
* ```
|
|
590
|
-
*
|
|
591
|
-
* @accessibility
|
|
592
|
-
* - Maintains proper heading hierarchy flow
|
|
593
|
-
* - Provides fine-grained content organization
|
|
594
|
-
* - Supports screen reader document navigation
|
|
136
|
+
* Props for Overline (Documentation only - NOT used in component implementation)
|
|
595
137
|
*/
|
|
596
|
-
function H4({ variant = "subHeadline", weight = "bold", ...props }: H4Props) {
|
|
597
|
-
return <Typography variant={variant} weight={weight} as="h4" {...props} />;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
138
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
601
|
-
type
|
|
602
|
-
/**
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
align?: "left" | "center" | "right" | "justify";
|
|
606
|
-
/** Text transformation for stylistic effects */
|
|
607
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
608
|
-
/** Font weight override for visual emphasis */
|
|
609
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
610
|
-
/** For label elements, the associated input ID for accessibility */
|
|
611
|
-
htmlFor?: string;
|
|
612
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
613
|
-
asChild?: boolean;
|
|
614
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
615
|
-
italic?: boolean;
|
|
616
|
-
/** Whether the text should have underline decoration @default false */
|
|
617
|
-
underline?: boolean;
|
|
618
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
619
|
-
strikethrough?: boolean;
|
|
620
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
621
|
-
truncate?: boolean;
|
|
622
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
623
|
-
srOnly?: boolean;
|
|
624
|
-
/** Additional CSS classes for custom styling */
|
|
139
|
+
type OverlineDocsProps = {
|
|
140
|
+
/** The HTML element to render @default "span" */
|
|
141
|
+
as?: React.ElementType;
|
|
142
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
625
143
|
className?: string;
|
|
626
|
-
/** Content to render within the
|
|
144
|
+
/** Content to render within the overline */
|
|
627
145
|
children?: React.ReactNode;
|
|
628
|
-
} & React.HTMLAttributes<
|
|
629
|
-
|
|
630
|
-
/** Props for H5 heading component */
|
|
631
|
-
type H5Props = Omit<TypographyProps, "as">;
|
|
146
|
+
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
632
147
|
|
|
633
148
|
/**
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
* Small headings for very specific content divisions. Uses "eyebrow" variant
|
|
637
|
-
* with h5 semantic element.
|
|
638
|
-
*
|
|
639
|
-
* @example
|
|
640
|
-
* ```tsx
|
|
641
|
-
* // Small section heading
|
|
642
|
-
* <H5>Error Codes</H5>
|
|
643
|
-
*
|
|
644
|
-
* // In lists or detailed breakdowns
|
|
645
|
-
* <H5 weight="semibold">Step 1: Setup</H5>
|
|
646
|
-
* ```
|
|
149
|
+
* Props for Code (Documentation only - NOT used in component implementation)
|
|
647
150
|
*/
|
|
648
|
-
function H5({ variant = "eyebrow", weight = "bold", ...props }: H5Props) {
|
|
649
|
-
return <Typography variant={variant} weight={weight} as="h5" {...props} />;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
151
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
653
|
-
type
|
|
654
|
-
/**
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
align?: "left" | "center" | "right" | "justify";
|
|
658
|
-
/** Text transformation for stylistic effects */
|
|
659
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
660
|
-
/** Font weight override for visual emphasis */
|
|
661
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
662
|
-
/** For label elements, the associated input ID for accessibility */
|
|
663
|
-
htmlFor?: string;
|
|
664
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
665
|
-
asChild?: boolean;
|
|
666
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
667
|
-
italic?: boolean;
|
|
668
|
-
/** Whether the text should have underline decoration @default false */
|
|
669
|
-
underline?: boolean;
|
|
670
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
671
|
-
strikethrough?: boolean;
|
|
672
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
673
|
-
truncate?: boolean;
|
|
674
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
675
|
-
srOnly?: boolean;
|
|
676
|
-
/** Additional CSS classes for custom styling */
|
|
152
|
+
type CodeDocsProps = {
|
|
153
|
+
/** The HTML element to render @default "code" */
|
|
154
|
+
as?: React.ElementType;
|
|
155
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
677
156
|
className?: string;
|
|
678
|
-
/** Content to render within the
|
|
157
|
+
/** Content to render within the code element */
|
|
679
158
|
children?: React.ReactNode;
|
|
680
|
-
} & React.HTMLAttributes<
|
|
681
|
-
|
|
682
|
-
/** Props for H6 heading component */
|
|
683
|
-
type H6Props = Omit<TypographyProps, "as">;
|
|
159
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
684
160
|
|
|
685
161
|
/**
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
* The smallest semantic heading level. Uses "details" variant with h6 element
|
|
689
|
-
* for minimal but semantic emphasis.
|
|
690
|
-
*
|
|
691
|
-
* @example
|
|
692
|
-
* ```tsx
|
|
693
|
-
* // Smallest heading
|
|
694
|
-
* <H6>Notes and Disclaimers</H6>
|
|
695
|
-
*
|
|
696
|
-
* // In deeply nested content
|
|
697
|
-
* <H6 color="muted">Technical Details</H6>
|
|
698
|
-
* ```
|
|
162
|
+
* Props for Blockquote (Documentation only - NOT used in component implementation)
|
|
699
163
|
*/
|
|
700
|
-
function H6({ variant = "body", weight = "bold", ...props }: H6Props) {
|
|
701
|
-
return <Typography variant={variant} weight={weight} as="h6" {...props} />;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
164
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
705
|
-
type
|
|
706
|
-
/**
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
align?: "left" | "center" | "right" | "justify";
|
|
710
|
-
/** Text transformation for stylistic effects */
|
|
711
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
712
|
-
/** Font weight override for visual emphasis */
|
|
713
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
714
|
-
/** For label elements, the associated input ID for accessibility */
|
|
715
|
-
htmlFor?: string;
|
|
716
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
717
|
-
asChild?: boolean;
|
|
718
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
719
|
-
italic?: boolean;
|
|
720
|
-
/** Whether the text should have underline decoration @default false */
|
|
721
|
-
underline?: boolean;
|
|
722
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
723
|
-
strikethrough?: boolean;
|
|
724
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
725
|
-
truncate?: boolean;
|
|
726
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
727
|
-
srOnly?: boolean;
|
|
728
|
-
/** Additional CSS classes for custom styling */
|
|
165
|
+
type BlockquoteDocsProps = {
|
|
166
|
+
/** The HTML element to render @default "blockquote" */
|
|
167
|
+
as?: React.ElementType;
|
|
168
|
+
/** Additional Tailwind CSS classes to customize styling */
|
|
729
169
|
className?: string;
|
|
730
|
-
/** Content to render within the
|
|
170
|
+
/** Content to render within the blockquote */
|
|
731
171
|
children?: React.ReactNode;
|
|
732
|
-
} & React.HTMLAttributes<
|
|
733
|
-
|
|
734
|
-
/** Props for P paragraph component */
|
|
735
|
-
type PProps = Omit<TypographyProps, "as">;
|
|
172
|
+
} & React.HTMLAttributes<HTMLQuoteElement>;
|
|
736
173
|
|
|
737
174
|
/**
|
|
738
|
-
*
|
|
175
|
+
* PageTitle - Primary page heading component
|
|
739
176
|
*
|
|
740
|
-
*
|
|
741
|
-
*
|
|
177
|
+
* The main heading for a page, typically used once per page. Uses text-3xl (30px)
|
|
178
|
+
* which is appropriate for web application page titles. Defaults to h1 element.
|
|
179
|
+
*
|
|
180
|
+
* @param as - HTML element to render @default "h1"
|
|
181
|
+
* @param className - Additional Tailwind classes (e.g., "text-4xl text-accent")
|
|
182
|
+
* @param children - Content to render
|
|
183
|
+
* @param ...props - All standard HTMLHeadingElement attributes
|
|
742
184
|
*
|
|
743
185
|
* @example
|
|
744
186
|
* ```tsx
|
|
745
|
-
* //
|
|
746
|
-
* <
|
|
187
|
+
* // Default usage
|
|
188
|
+
* <PageTitle>User Dashboard</PageTitle>
|
|
747
189
|
*
|
|
748
|
-
* // With
|
|
749
|
-
* <
|
|
190
|
+
* // With custom styling
|
|
191
|
+
* <PageTitle className="text-4xl text-accent">
|
|
192
|
+
* Custom Styled Title
|
|
193
|
+
* </PageTitle>
|
|
750
194
|
*
|
|
751
|
-
* //
|
|
752
|
-
* <
|
|
195
|
+
* // As different element
|
|
196
|
+
* <PageTitle as="h2">Section Title as H2</PageTitle>
|
|
753
197
|
*
|
|
754
|
-
* //
|
|
755
|
-
* <
|
|
756
|
-
*
|
|
757
|
-
* </
|
|
198
|
+
* // Responsive sizing
|
|
199
|
+
* <PageTitle className="text-2xl md:text-3xl lg:text-4xl">
|
|
200
|
+
* Responsive Title
|
|
201
|
+
* </PageTitle>
|
|
758
202
|
* ```
|
|
759
203
|
*
|
|
760
204
|
* @accessibility
|
|
761
|
-
* -
|
|
762
|
-
* -
|
|
763
|
-
* -
|
|
764
|
-
*
|
|
765
|
-
* @see {@link Typography} Base typography component
|
|
205
|
+
* - Should be used once per page for proper document outline
|
|
206
|
+
* - Provides main page topic for screen readers
|
|
207
|
+
* - Helps with keyboard navigation landmarks
|
|
766
208
|
*/
|
|
767
|
-
function
|
|
768
|
-
|
|
209
|
+
export function PageTitle<T extends React.ElementType = "h1">({
|
|
210
|
+
className,
|
|
211
|
+
as,
|
|
212
|
+
...props
|
|
213
|
+
}: TypographyProps<T>) {
|
|
214
|
+
const Component = as || "h1";
|
|
215
|
+
return (
|
|
216
|
+
<Component
|
|
217
|
+
className={cn("text-3xl font-bold leading-tight tracking-wide", className)}
|
|
218
|
+
{...props}
|
|
219
|
+
/>
|
|
220
|
+
);
|
|
769
221
|
}
|
|
770
222
|
|
|
771
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
772
|
-
type SpanDocsProps = {
|
|
773
|
-
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
774
|
-
variant?: TypographyVariant;
|
|
775
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
776
|
-
color?: TypographyColor;
|
|
777
|
-
/** Text alignment within the container @default "left" */
|
|
778
|
-
align?: "left" | "center" | "right" | "justify";
|
|
779
|
-
/** Text transformation for stylistic effects */
|
|
780
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
781
|
-
/** Font weight override for visual emphasis */
|
|
782
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
783
|
-
/** For label elements, the associated input ID for accessibility */
|
|
784
|
-
htmlFor?: string;
|
|
785
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
786
|
-
asChild?: boolean;
|
|
787
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
788
|
-
italic?: boolean;
|
|
789
|
-
/** Whether the text should have underline decoration @default false */
|
|
790
|
-
underline?: boolean;
|
|
791
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
792
|
-
strikethrough?: boolean;
|
|
793
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
794
|
-
truncate?: boolean;
|
|
795
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
796
|
-
srOnly?: boolean;
|
|
797
|
-
/** Additional CSS classes for custom styling */
|
|
798
|
-
className?: string;
|
|
799
|
-
/** Content to render within the typography element */
|
|
800
|
-
children?: React.ReactNode;
|
|
801
|
-
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
802
|
-
|
|
803
|
-
/** Props for Span inline component */
|
|
804
|
-
type SpanProps = Omit<TypographyProps, "as">;
|
|
805
|
-
|
|
806
223
|
/**
|
|
807
|
-
*
|
|
224
|
+
* SectionTitle - Secondary section heading component
|
|
225
|
+
*
|
|
226
|
+
* Section headings that divide page content into logical groups. Uses text-2xl (24px)
|
|
227
|
+
* for clear hierarchy below PageTitle. Defaults to h2 element.
|
|
808
228
|
*
|
|
809
|
-
*
|
|
810
|
-
*
|
|
229
|
+
* @param as - HTML element to render @default "h2"
|
|
230
|
+
* @param className - Additional Tailwind classes
|
|
231
|
+
* @param children - Content to render
|
|
232
|
+
* @param ...props - All standard HTMLHeadingElement attributes
|
|
811
233
|
*
|
|
812
234
|
* @example
|
|
813
235
|
* ```tsx
|
|
814
|
-
* //
|
|
815
|
-
* <
|
|
816
|
-
* Regular text with <Span color="accent" weight="semibold">highlighted</Span> content
|
|
817
|
-
* </p>
|
|
236
|
+
* // Default usage
|
|
237
|
+
* <SectionTitle>Recent Activity</SectionTitle>
|
|
818
238
|
*
|
|
819
|
-
* //
|
|
820
|
-
* <
|
|
821
|
-
*
|
|
822
|
-
* </
|
|
239
|
+
* // With custom color
|
|
240
|
+
* <SectionTitle className="text-accent">
|
|
241
|
+
* Featured Section
|
|
242
|
+
* </SectionTitle>
|
|
823
243
|
*
|
|
824
|
-
* //
|
|
825
|
-
* <
|
|
826
|
-
* onClick
|
|
827
|
-
* </Span>
|
|
244
|
+
* // As h3 element
|
|
245
|
+
* <SectionTitle as="h3">Subsection Title</SectionTitle>
|
|
828
246
|
* ```
|
|
829
247
|
*
|
|
830
248
|
* @accessibility
|
|
831
|
-
* - Maintains
|
|
832
|
-
* -
|
|
833
|
-
* -
|
|
249
|
+
* - Maintains document outline hierarchy
|
|
250
|
+
* - Should follow PageTitle (h1) in document flow
|
|
251
|
+
* - Provides section navigation for screen readers
|
|
834
252
|
*/
|
|
835
|
-
function
|
|
836
|
-
|
|
253
|
+
export function SectionTitle<T extends React.ElementType = "h2">({
|
|
254
|
+
className,
|
|
255
|
+
as,
|
|
256
|
+
...props
|
|
257
|
+
}: TypographyProps<T>) {
|
|
258
|
+
const Component = as || "h2";
|
|
259
|
+
return (
|
|
260
|
+
<Component
|
|
261
|
+
className={cn("text-2xl font-semibold leading-tight tracking-wide", className)}
|
|
262
|
+
{...props}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
837
265
|
}
|
|
838
266
|
|
|
839
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
840
|
-
type CodeDocsProps = {
|
|
841
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
842
|
-
color?: TypographyColor;
|
|
843
|
-
/** Text alignment within the container @default "left" */
|
|
844
|
-
align?: "left" | "center" | "right" | "justify";
|
|
845
|
-
/** Text transformation for stylistic effects */
|
|
846
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
847
|
-
/** Font weight override for visual emphasis */
|
|
848
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
849
|
-
/** For label elements, the associated input ID for accessibility */
|
|
850
|
-
htmlFor?: string;
|
|
851
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
852
|
-
asChild?: boolean;
|
|
853
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
854
|
-
italic?: boolean;
|
|
855
|
-
/** Whether the text should have underline decoration @default false */
|
|
856
|
-
underline?: boolean;
|
|
857
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
858
|
-
strikethrough?: boolean;
|
|
859
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
860
|
-
truncate?: boolean;
|
|
861
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
862
|
-
srOnly?: boolean;
|
|
863
|
-
/** Additional CSS classes for custom styling */
|
|
864
|
-
className?: string;
|
|
865
|
-
/** Content to render within the typography element */
|
|
866
|
-
children?: React.ReactNode;
|
|
867
|
-
} & React.HTMLAttributes<HTMLElement>;
|
|
868
|
-
|
|
869
|
-
/** Props for Code component */
|
|
870
|
-
type CodeProps = Omit<TypographyProps, "as" | "variant">;
|
|
871
|
-
|
|
872
267
|
/**
|
|
873
|
-
*
|
|
268
|
+
* SubsectionTitle - Tertiary subsection heading component
|
|
269
|
+
*
|
|
270
|
+
* Subsection headings for further content division. Uses text-xl (20px) for
|
|
271
|
+
* subtle distinction from SectionTitle. Defaults to h3 element.
|
|
874
272
|
*
|
|
875
|
-
*
|
|
876
|
-
*
|
|
273
|
+
* @param as - HTML element to render @default "h3"
|
|
274
|
+
* @param className - Additional Tailwind classes
|
|
275
|
+
* @param children - Content to render
|
|
276
|
+
* @param ...props - All standard HTMLHeadingElement attributes
|
|
877
277
|
*
|
|
878
278
|
* @example
|
|
879
279
|
* ```tsx
|
|
880
|
-
* //
|
|
881
|
-
* <
|
|
882
|
-
*
|
|
883
|
-
* // Terminal command
|
|
884
|
-
* <Code color="muted">npm install @neynar/react</Code>
|
|
280
|
+
* // Default usage
|
|
281
|
+
* <SubsectionTitle>Configuration Options</SubsectionTitle>
|
|
885
282
|
*
|
|
886
|
-
* //
|
|
887
|
-
* <
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
* <Code className="bg-muted px-2 py-1 rounded">
|
|
891
|
-
* function handleClick()
|
|
892
|
-
* </Code>
|
|
283
|
+
* // With custom styling
|
|
284
|
+
* <SubsectionTitle className="text-muted-foreground">
|
|
285
|
+
* Optional Settings
|
|
286
|
+
* </SubsectionTitle>
|
|
893
287
|
* ```
|
|
894
288
|
*
|
|
895
289
|
* @accessibility
|
|
896
|
-
* -
|
|
897
|
-
* -
|
|
898
|
-
* -
|
|
899
|
-
* - Maintains proper inline behavior within text
|
|
900
|
-
*
|
|
901
|
-
* @see {@link Typography} Base typography component for multi-line code blocks
|
|
290
|
+
* - Should follow SectionTitle (h2) in document flow
|
|
291
|
+
* - Helps create detailed content structure
|
|
292
|
+
* - Supports screen reader document navigation
|
|
902
293
|
*/
|
|
903
|
-
function
|
|
904
|
-
|
|
294
|
+
export function SubsectionTitle<T extends React.ElementType = "h3">({
|
|
295
|
+
className,
|
|
296
|
+
as,
|
|
297
|
+
...props
|
|
298
|
+
}: TypographyProps<T>) {
|
|
299
|
+
const Component = as || "h3";
|
|
300
|
+
return (
|
|
301
|
+
<Component
|
|
302
|
+
className={cn("text-xl font-semibold leading-snug tracking-wide", className)}
|
|
303
|
+
{...props}
|
|
304
|
+
/>
|
|
305
|
+
);
|
|
905
306
|
}
|
|
906
307
|
|
|
907
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
908
|
-
type SmallDocsProps = {
|
|
909
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
910
|
-
color?: TypographyColor;
|
|
911
|
-
/** Text alignment within the container @default "left" */
|
|
912
|
-
align?: "left" | "center" | "right" | "justify";
|
|
913
|
-
/** Text transformation for stylistic effects */
|
|
914
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
915
|
-
/** Font weight override for visual emphasis */
|
|
916
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
917
|
-
/** For label elements, the associated input ID for accessibility */
|
|
918
|
-
htmlFor?: string;
|
|
919
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
920
|
-
asChild?: boolean;
|
|
921
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
922
|
-
italic?: boolean;
|
|
923
|
-
/** Whether the text should have underline decoration @default false */
|
|
924
|
-
underline?: boolean;
|
|
925
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
926
|
-
strikethrough?: boolean;
|
|
927
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
928
|
-
truncate?: boolean;
|
|
929
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
930
|
-
srOnly?: boolean;
|
|
931
|
-
/** Additional CSS classes for custom styling */
|
|
932
|
-
className?: string;
|
|
933
|
-
/** Content to render within the typography element */
|
|
934
|
-
children?: React.ReactNode;
|
|
935
|
-
} & React.HTMLAttributes<HTMLElement>;
|
|
936
|
-
|
|
937
|
-
/** Props for Small component */
|
|
938
|
-
type SmallProps = Omit<TypographyProps, "as">;
|
|
939
|
-
|
|
940
308
|
/**
|
|
941
|
-
*
|
|
309
|
+
* BodyText - Primary paragraph text component
|
|
310
|
+
*
|
|
311
|
+
* Standard paragraph element for readable body text. Uses text-base (16px) with
|
|
312
|
+
* relaxed line height for optimal readability. Defaults to p element.
|
|
942
313
|
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
314
|
+
* @param as - HTML element to render @default "p"
|
|
315
|
+
* @param className - Additional Tailwind classes
|
|
316
|
+
* @param children - Content to render
|
|
317
|
+
* @param ...props - All standard HTMLParagraphElement attributes
|
|
945
318
|
*
|
|
946
319
|
* @example
|
|
947
320
|
* ```tsx
|
|
948
|
-
* //
|
|
949
|
-
* <
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
|
-
* <Small color="muted">Last updated 2 minutes ago</Small>
|
|
953
|
-
*
|
|
954
|
-
* // Copyright notice
|
|
955
|
-
* <Small className="text-center">
|
|
956
|
-
* © 2024 Neynar. All rights reserved.
|
|
957
|
-
* </Small>
|
|
321
|
+
* // Default usage
|
|
322
|
+
* <BodyText>
|
|
323
|
+
* This is standard body text that provides information to the user.
|
|
324
|
+
* </BodyText>
|
|
958
325
|
*
|
|
959
|
-
* //
|
|
960
|
-
* <
|
|
326
|
+
* // With custom styling
|
|
327
|
+
* <BodyText className="text-muted-foreground">
|
|
328
|
+
* Secondary information with reduced visual prominence.
|
|
329
|
+
* </BodyText>
|
|
330
|
+
*
|
|
331
|
+
* // As different element
|
|
332
|
+
* <BodyText as="div">
|
|
333
|
+
* Body text in a div container.
|
|
334
|
+
* </BodyText>
|
|
961
335
|
* ```
|
|
962
336
|
*
|
|
963
337
|
* @accessibility
|
|
964
|
-
* -
|
|
965
|
-
* -
|
|
966
|
-
* -
|
|
967
|
-
* - Works well with form help text and descriptions
|
|
338
|
+
* - Provides proper semantic structure for body content
|
|
339
|
+
* - Maintains readable line height for accessibility
|
|
340
|
+
* - Supports screen reader text flow and navigation
|
|
968
341
|
*/
|
|
969
|
-
function
|
|
970
|
-
|
|
342
|
+
export function BodyText<T extends React.ElementType = "p">({
|
|
343
|
+
className,
|
|
344
|
+
as,
|
|
345
|
+
...props
|
|
346
|
+
}: TypographyProps<T>) {
|
|
347
|
+
const Component = as || "p";
|
|
348
|
+
return (
|
|
349
|
+
<Component
|
|
350
|
+
className={cn("text-base leading-relaxed tracking-wide", className)}
|
|
351
|
+
{...props}
|
|
352
|
+
/>
|
|
353
|
+
);
|
|
971
354
|
}
|
|
972
355
|
|
|
973
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
974
|
-
type StrongDocsProps = {
|
|
975
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
976
|
-
color?: TypographyColor;
|
|
977
|
-
/** Text alignment within the container @default "left" */
|
|
978
|
-
align?: "left" | "center" | "right" | "justify";
|
|
979
|
-
/** Text transformation for stylistic effects */
|
|
980
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
981
|
-
/** Font weight override for visual emphasis */
|
|
982
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
983
|
-
/** For label elements, the associated input ID for accessibility */
|
|
984
|
-
htmlFor?: string;
|
|
985
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
986
|
-
asChild?: boolean;
|
|
987
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
988
|
-
italic?: boolean;
|
|
989
|
-
/** Whether the text should have underline decoration @default false */
|
|
990
|
-
underline?: boolean;
|
|
991
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
992
|
-
strikethrough?: boolean;
|
|
993
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
994
|
-
truncate?: boolean;
|
|
995
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
996
|
-
srOnly?: boolean;
|
|
997
|
-
/** Additional CSS classes for custom styling */
|
|
998
|
-
className?: string;
|
|
999
|
-
/** Content to render within the typography element */
|
|
1000
|
-
children?: React.ReactNode;
|
|
1001
|
-
} & React.HTMLAttributes<HTMLElement>;
|
|
1002
|
-
|
|
1003
|
-
/** Props for Strong component */
|
|
1004
|
-
type StrongProps = Omit<TypographyProps, "as">;
|
|
1005
|
-
|
|
1006
356
|
/**
|
|
1007
|
-
*
|
|
357
|
+
* BodyTextLarge - Emphasized body text component
|
|
358
|
+
*
|
|
359
|
+
* Larger body text for lead paragraphs and emphasized content. Uses text-lg (18px)
|
|
360
|
+
* with relaxed line height. Defaults to p element.
|
|
1008
361
|
*
|
|
1009
|
-
*
|
|
1010
|
-
*
|
|
362
|
+
* @param as - HTML element to render @default "p"
|
|
363
|
+
* @param className - Additional Tailwind classes
|
|
364
|
+
* @param children - Content to render
|
|
365
|
+
* @param ...props - All standard HTMLParagraphElement attributes
|
|
1011
366
|
*
|
|
1012
367
|
* @example
|
|
1013
368
|
* ```tsx
|
|
1014
|
-
* //
|
|
1015
|
-
* <
|
|
369
|
+
* // Lead paragraph
|
|
370
|
+
* <BodyTextLarge>
|
|
371
|
+
* This is a lead paragraph that introduces the main content.
|
|
372
|
+
* </BodyTextLarge>
|
|
373
|
+
*
|
|
374
|
+
* // Emphasized content
|
|
375
|
+
* <BodyTextLarge className="font-medium text-accent">
|
|
376
|
+
* Important announcement text.
|
|
377
|
+
* </BodyTextLarge>
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
export function BodyTextLarge<T extends React.ElementType = "p">({
|
|
381
|
+
className,
|
|
382
|
+
as,
|
|
383
|
+
...props
|
|
384
|
+
}: TypographyProps<T>) {
|
|
385
|
+
const Component = as || "p";
|
|
386
|
+
return (
|
|
387
|
+
<Component
|
|
388
|
+
className={cn("text-lg leading-relaxed tracking-wide", className)}
|
|
389
|
+
{...props}
|
|
390
|
+
/>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* BodyTextSmall - De-emphasized body text component
|
|
1016
396
|
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
397
|
+
* Smaller body text for less prominent content. Uses text-sm (14px) with
|
|
398
|
+
* normal line height. Defaults to p element.
|
|
1019
399
|
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
400
|
+
* @param as - HTML element to render @default "p"
|
|
401
|
+
* @param className - Additional Tailwind classes
|
|
402
|
+
* @param children - Content to render
|
|
403
|
+
* @param ...props - All standard HTMLParagraphElement attributes
|
|
1024
404
|
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```tsx
|
|
407
|
+
* // Small body text
|
|
408
|
+
* <BodyTextSmall>
|
|
409
|
+
* This is smaller, less prominent body text.
|
|
410
|
+
* </BodyTextSmall>
|
|
411
|
+
*
|
|
412
|
+
* // Helper text
|
|
413
|
+
* <BodyTextSmall className="text-muted-foreground">
|
|
414
|
+
* Additional context or helper information.
|
|
415
|
+
* </BodyTextSmall>
|
|
1027
416
|
* ```
|
|
1028
|
-
*
|
|
1029
|
-
* @accessibility
|
|
1030
|
-
* - Uses semantic strong element for emphasis
|
|
1031
|
-
* - Screen readers understand this as important content
|
|
1032
|
-
* - Provides semantic meaning beyond visual styling
|
|
1033
|
-
* - Maintains proper emphasis hierarchy in content
|
|
1034
417
|
*/
|
|
1035
|
-
function
|
|
1036
|
-
|
|
418
|
+
export function BodyTextSmall<T extends React.ElementType = "p">({
|
|
419
|
+
className,
|
|
420
|
+
as,
|
|
421
|
+
...props
|
|
422
|
+
}: TypographyProps<T>) {
|
|
423
|
+
const Component = as || "p";
|
|
424
|
+
return (
|
|
425
|
+
<Component
|
|
426
|
+
className={cn("text-sm leading-normal tracking-wide", className)}
|
|
427
|
+
{...props}
|
|
428
|
+
/>
|
|
429
|
+
);
|
|
1037
430
|
}
|
|
1038
431
|
|
|
1039
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1040
|
-
type LeadDocsProps = {
|
|
1041
|
-
/** Color variant for semantic meaning and visual hierarchy @default "muted" */
|
|
1042
|
-
color?: TypographyColor;
|
|
1043
|
-
/** Text alignment within the container @default "left" */
|
|
1044
|
-
align?: "left" | "center" | "right" | "justify";
|
|
1045
|
-
/** Text transformation for stylistic effects */
|
|
1046
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1047
|
-
/** Font weight override for visual emphasis */
|
|
1048
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1049
|
-
/** For label elements, the associated input ID for accessibility */
|
|
1050
|
-
htmlFor?: string;
|
|
1051
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1052
|
-
asChild?: boolean;
|
|
1053
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
1054
|
-
italic?: boolean;
|
|
1055
|
-
/** Whether the text should have underline decoration @default false */
|
|
1056
|
-
underline?: boolean;
|
|
1057
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
1058
|
-
strikethrough?: boolean;
|
|
1059
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1060
|
-
truncate?: boolean;
|
|
1061
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
1062
|
-
srOnly?: boolean;
|
|
1063
|
-
/** Additional CSS classes for custom styling */
|
|
1064
|
-
className?: string;
|
|
1065
|
-
/** Content to render within the typography element */
|
|
1066
|
-
children?: React.ReactNode;
|
|
1067
|
-
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
1068
|
-
|
|
1069
|
-
/** Props for Lead component */
|
|
1070
|
-
type LeadProps = Omit<TypographyProps, "as">;
|
|
1071
|
-
|
|
1072
432
|
/**
|
|
1073
|
-
*
|
|
433
|
+
* Caption - Small supplementary text component
|
|
434
|
+
*
|
|
435
|
+
* Small text for metadata, timestamps, and supplementary information. Uses text-sm (14px)
|
|
436
|
+
* with muted color. Defaults to span element for inline usage.
|
|
1074
437
|
*
|
|
1075
|
-
*
|
|
1076
|
-
*
|
|
438
|
+
* @param as - HTML element to render @default "span"
|
|
439
|
+
* @param className - Additional Tailwind classes
|
|
440
|
+
* @param children - Content to render
|
|
441
|
+
* @param ...props - All standard HTMLSpanElement attributes
|
|
1077
442
|
*
|
|
1078
443
|
* @example
|
|
1079
444
|
* ```tsx
|
|
1080
|
-
* //
|
|
1081
|
-
* <
|
|
1082
|
-
* This comprehensive guide covers everything you need to know about
|
|
1083
|
-
* building modern web applications with React and TypeScript.
|
|
1084
|
-
* </Lead>
|
|
445
|
+
* // Timestamp
|
|
446
|
+
* <Caption>Last updated 2 minutes ago</Caption>
|
|
1085
447
|
*
|
|
1086
|
-
* //
|
|
1087
|
-
* <
|
|
1088
|
-
* Discover powerful APIs and tools to build the next generation
|
|
1089
|
-
* of social applications on Farcaster.
|
|
1090
|
-
* </Lead>
|
|
448
|
+
* // Image caption
|
|
449
|
+
* <Caption>Figure 1: System architecture diagram</Caption>
|
|
1091
450
|
*
|
|
1092
|
-
* //
|
|
1093
|
-
* <
|
|
1094
|
-
*
|
|
1095
|
-
* </
|
|
451
|
+
* // Metadata
|
|
452
|
+
* <Caption className="block mt-2">
|
|
453
|
+
* Created by John Doe on Jan 15, 2025
|
|
454
|
+
* </Caption>
|
|
1096
455
|
* ```
|
|
1097
456
|
*
|
|
1098
457
|
* @accessibility
|
|
1099
|
-
* -
|
|
1100
|
-
* -
|
|
1101
|
-
* -
|
|
458
|
+
* - Maintains inline text flow for screen readers
|
|
459
|
+
* - Sufficient contrast with muted color
|
|
460
|
+
* - Works well for supplementary information
|
|
1102
461
|
*/
|
|
1103
|
-
function
|
|
1104
|
-
|
|
1105
|
-
|
|
462
|
+
export function Caption<T extends React.ElementType = "span">({
|
|
463
|
+
className,
|
|
464
|
+
as,
|
|
1106
465
|
...props
|
|
1107
|
-
}:
|
|
1108
|
-
|
|
466
|
+
}: TypographyProps<T>) {
|
|
467
|
+
const Component = as || "span";
|
|
468
|
+
return (
|
|
469
|
+
<Component
|
|
470
|
+
className={cn("text-sm text-muted-foreground leading-normal tracking-wide", className)}
|
|
471
|
+
{...props}
|
|
472
|
+
/>
|
|
473
|
+
);
|
|
1109
474
|
}
|
|
1110
475
|
|
|
1111
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1112
|
-
type ADocsProps = {
|
|
1113
|
-
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
1114
|
-
variant?: TypographyVariant;
|
|
1115
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
1116
|
-
color?: TypographyColor;
|
|
1117
|
-
/** Text alignment within the container @default "left" */
|
|
1118
|
-
align?: "left" | "center" | "right" | "justify";
|
|
1119
|
-
/** Text transformation for stylistic effects */
|
|
1120
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1121
|
-
/** Font weight override for visual emphasis */
|
|
1122
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1123
|
-
/** For label elements, the associated input ID for accessibility */
|
|
1124
|
-
htmlFor?: string;
|
|
1125
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1126
|
-
asChild?: boolean;
|
|
1127
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
1128
|
-
italic?: boolean;
|
|
1129
|
-
/** Whether the text should have underline decoration @default false */
|
|
1130
|
-
underline?: boolean;
|
|
1131
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
1132
|
-
strikethrough?: boolean;
|
|
1133
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1134
|
-
truncate?: boolean;
|
|
1135
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
1136
|
-
srOnly?: boolean;
|
|
1137
|
-
/** Link destination URL */
|
|
1138
|
-
href?: string;
|
|
1139
|
-
/** Additional CSS classes for custom styling */
|
|
1140
|
-
className?: string;
|
|
1141
|
-
/** Content to render within the typography element */
|
|
1142
|
-
children?: React.ReactNode;
|
|
1143
|
-
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
1144
|
-
|
|
1145
|
-
/** Props for A anchor component */
|
|
1146
|
-
type AProps = Omit<TypographyProps, "as"> & {
|
|
1147
|
-
/** Link destination URL */
|
|
1148
|
-
href?: string;
|
|
1149
|
-
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
1150
476
|
|
|
1151
477
|
/**
|
|
1152
|
-
*
|
|
478
|
+
* Overline - Small uppercase label component
|
|
479
|
+
*
|
|
480
|
+
* Small uppercase text for category tags and eyebrow labels. Uses text-xs (12px)
|
|
481
|
+
* with uppercase transformation and wide tracking. Defaults to span element.
|
|
1153
482
|
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
483
|
+
* @param as - HTML element to render @default "span"
|
|
484
|
+
* @param className - Additional Tailwind classes
|
|
485
|
+
* @param children - Content to render
|
|
486
|
+
* @param ...props - All standard HTMLSpanElement attributes
|
|
1156
487
|
*
|
|
1157
488
|
* @example
|
|
1158
489
|
* ```tsx
|
|
1159
|
-
* //
|
|
1160
|
-
* <
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
490
|
+
* // Category label
|
|
491
|
+
* <Overline>Featured</Overline>
|
|
492
|
+
*
|
|
493
|
+
* // Section eyebrow
|
|
494
|
+
* <Overline className="text-accent-foreground">
|
|
495
|
+
* New Feature
|
|
496
|
+
* </Overline>
|
|
497
|
+
*
|
|
498
|
+
* // Tag
|
|
499
|
+
* <Overline className="bg-accent px-2 py-1 rounded">
|
|
500
|
+
* Beta
|
|
501
|
+
* </Overline>
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
export function Overline<T extends React.ElementType = "span">({
|
|
505
|
+
className,
|
|
506
|
+
as,
|
|
507
|
+
...props
|
|
508
|
+
}: TypographyProps<T>) {
|
|
509
|
+
const Component = as || "span";
|
|
510
|
+
return (
|
|
511
|
+
<Component
|
|
512
|
+
className={cn("text-xs font-medium uppercase tracking-wider", className)}
|
|
513
|
+
{...props}
|
|
514
|
+
/>
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Code - Inline code component
|
|
520
|
+
*
|
|
521
|
+
* Monospace text for inline code snippets and technical references. Uses text-sm
|
|
522
|
+
* with monospace font and subtle background. Defaults to code element.
|
|
523
|
+
*
|
|
524
|
+
* @param as - HTML element to render @default "code"
|
|
525
|
+
* @param className - Additional Tailwind classes
|
|
526
|
+
* @param children - Content to render
|
|
527
|
+
* @param ...props - All standard HTMLElement attributes
|
|
1163
528
|
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```tsx
|
|
531
|
+
* // Inline code
|
|
532
|
+
* <Code>const message = "Hello, world!";</Code>
|
|
1168
533
|
*
|
|
1169
|
-
* //
|
|
1170
|
-
* <
|
|
1171
|
-
* <Link href="/about">
|
|
1172
|
-
* Learn More About Us
|
|
1173
|
-
* </Link>
|
|
1174
|
-
* </A>
|
|
534
|
+
* // Variable reference
|
|
535
|
+
* <p>Set the <Code>API_KEY</Code> environment variable.</p>
|
|
1175
536
|
*
|
|
1176
|
-
* //
|
|
1177
|
-
* <
|
|
1178
|
-
* For more information, <A href="/docs">check our documentation</A> or
|
|
1179
|
-
* contact support.
|
|
1180
|
-
* </P>
|
|
537
|
+
* // Terminal command
|
|
538
|
+
* <Code className="bg-accent">npm install @neynar/ui</Code>
|
|
1181
539
|
* ```
|
|
1182
540
|
*
|
|
1183
541
|
* @accessibility
|
|
1184
|
-
* - Uses semantic
|
|
1185
|
-
* -
|
|
1186
|
-
* -
|
|
1187
|
-
* - Maintains color contrast requirements for links
|
|
1188
|
-
* - Works with screen reader link navigation modes
|
|
1189
|
-
* - Supports external link indicators when needed
|
|
1190
|
-
*
|
|
1191
|
-
* @see {@link Typography} Base typography component with asChild
|
|
542
|
+
* - Uses semantic code element for proper meaning
|
|
543
|
+
* - Monospace font aids in code readability
|
|
544
|
+
* - Screen readers understand this as technical content
|
|
1192
545
|
*/
|
|
1193
|
-
function
|
|
546
|
+
export function Code<T extends React.ElementType = "code">({
|
|
547
|
+
className,
|
|
548
|
+
as,
|
|
549
|
+
...props
|
|
550
|
+
}: TypographyProps<T>) {
|
|
551
|
+
const Component = as || "code";
|
|
1194
552
|
return (
|
|
1195
|
-
<
|
|
1196
|
-
|
|
1197
|
-
asChild={asChild}
|
|
1198
|
-
className={cn(
|
|
1199
|
-
"underline underline-offset-2 hover:text-primary transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
1200
|
-
className,
|
|
1201
|
-
)}
|
|
1202
|
-
{...(href ? { href } : {})}
|
|
553
|
+
<Component
|
|
554
|
+
className={cn("font-mono text-sm bg-muted px-1 rounded", className)}
|
|
1203
555
|
{...props}
|
|
1204
556
|
/>
|
|
1205
557
|
);
|
|
1206
558
|
}
|
|
1207
559
|
|
|
1208
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1209
|
-
type BlockquoteDocsProps = {
|
|
1210
|
-
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
1211
|
-
color?: TypographyColor;
|
|
1212
|
-
/** Text alignment within the container @default "left" */
|
|
1213
|
-
align?: "left" | "center" | "right" | "justify";
|
|
1214
|
-
/** Text transformation for stylistic effects */
|
|
1215
|
-
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1216
|
-
/** Font weight override for visual emphasis */
|
|
1217
|
-
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1218
|
-
/** For label elements, the associated input ID for accessibility */
|
|
1219
|
-
htmlFor?: string;
|
|
1220
|
-
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1221
|
-
asChild?: boolean;
|
|
1222
|
-
/** Whether the text should be rendered in italic style @default false */
|
|
1223
|
-
italic?: boolean;
|
|
1224
|
-
/** Whether the text should have underline decoration @default false */
|
|
1225
|
-
underline?: boolean;
|
|
1226
|
-
/** Whether the text should have strikethrough decoration @default false */
|
|
1227
|
-
strikethrough?: boolean;
|
|
1228
|
-
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1229
|
-
truncate?: boolean;
|
|
1230
|
-
/** Hide visually but keep accessible to screen readers @default false */
|
|
1231
|
-
srOnly?: boolean;
|
|
1232
|
-
/** Additional CSS classes for custom styling */
|
|
1233
|
-
className?: string;
|
|
1234
|
-
/** Content to render within the typography element */
|
|
1235
|
-
children?: React.ReactNode;
|
|
1236
|
-
} & React.HTMLAttributes<HTMLQuoteElement>;
|
|
1237
|
-
|
|
1238
|
-
/** Props for Blockquote component */
|
|
1239
|
-
type BlockquoteProps = Omit<TypographyProps, "as">;
|
|
1240
|
-
|
|
1241
560
|
/**
|
|
1242
|
-
* Blockquote - Quoted text component
|
|
561
|
+
* Blockquote - Quoted text component
|
|
562
|
+
*
|
|
563
|
+
* Semantic blockquote element for extended quotations and excerpts. Features
|
|
564
|
+
* italic styling and left border for visual distinction. Defaults to blockquote element.
|
|
1243
565
|
*
|
|
1244
|
-
*
|
|
1245
|
-
*
|
|
566
|
+
* @param as - HTML element to render @default "blockquote"
|
|
567
|
+
* @param className - Additional Tailwind classes
|
|
568
|
+
* @param children - Content to render
|
|
569
|
+
* @param ...props - All standard HTMLQuoteElement attributes
|
|
1246
570
|
*
|
|
1247
571
|
* @example
|
|
1248
572
|
* ```tsx
|
|
@@ -1253,17 +577,15 @@ type BlockquoteProps = Omit<TypographyProps, "as">;
|
|
|
1253
577
|
*
|
|
1254
578
|
* // With attribution
|
|
1255
579
|
* <div>
|
|
1256
|
-
* <Blockquote
|
|
1257
|
-
* "Building great products requires deep understanding of user needs
|
|
1258
|
-
* and technical excellence in equal measure."
|
|
580
|
+
* <Blockquote>
|
|
581
|
+
* "Building great products requires deep understanding of user needs."
|
|
1259
582
|
* </Blockquote>
|
|
1260
|
-
* <
|
|
583
|
+
* <Caption className="mt-2">— Product Team</Caption>
|
|
1261
584
|
* </div>
|
|
1262
585
|
*
|
|
1263
|
-
* //
|
|
1264
|
-
* <Blockquote
|
|
1265
|
-
*
|
|
1266
|
-
* The developer experience is exceptional."
|
|
586
|
+
* // Custom styling
|
|
587
|
+
* <Blockquote className="bg-muted/50 p-4 rounded-lg">
|
|
588
|
+
* Customer testimonial or feedback.
|
|
1267
589
|
* </Blockquote>
|
|
1268
590
|
* ```
|
|
1269
591
|
*
|
|
@@ -1271,59 +593,17 @@ type BlockquoteProps = Omit<TypographyProps, "as">;
|
|
|
1271
593
|
* - Uses semantic blockquote element for proper quotation meaning
|
|
1272
594
|
* - Screen readers understand this as quoted content
|
|
1273
595
|
* - Maintains proper text flow and readability
|
|
1274
|
-
* - Supports citation attribution when paired with cite element
|
|
1275
|
-
*
|
|
1276
|
-
* @see {@link Small} For attribution text
|
|
1277
|
-
* @see {@link Typography} Base typography component
|
|
1278
596
|
*/
|
|
1279
|
-
function Blockquote
|
|
597
|
+
export function Blockquote<T extends React.ElementType = "blockquote">({
|
|
598
|
+
className,
|
|
599
|
+
as,
|
|
600
|
+
...props
|
|
601
|
+
}: TypographyProps<T>) {
|
|
602
|
+
const Component = as || "blockquote";
|
|
1280
603
|
return (
|
|
1281
|
-
<
|
|
1282
|
-
|
|
1283
|
-
italic
|
|
1284
|
-
className={cn("border-l-4 border-border pl-4 my-2", className)}
|
|
604
|
+
<Component
|
|
605
|
+
className={cn("border-l-4 border-border pl-4 italic tracking-wide", className)}
|
|
1285
606
|
{...props}
|
|
1286
607
|
/>
|
|
1287
608
|
);
|
|
1288
609
|
}
|
|
1289
|
-
|
|
1290
|
-
export {
|
|
1291
|
-
Typography,
|
|
1292
|
-
H1,
|
|
1293
|
-
H2,
|
|
1294
|
-
H3,
|
|
1295
|
-
H4,
|
|
1296
|
-
H5,
|
|
1297
|
-
H6,
|
|
1298
|
-
P,
|
|
1299
|
-
Span,
|
|
1300
|
-
Code,
|
|
1301
|
-
Small,
|
|
1302
|
-
Strong,
|
|
1303
|
-
Lead,
|
|
1304
|
-
A,
|
|
1305
|
-
Blockquote,
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
export type {
|
|
1309
|
-
TypographyProps,
|
|
1310
|
-
H1Props,
|
|
1311
|
-
H2Props,
|
|
1312
|
-
H3Props,
|
|
1313
|
-
H4Props,
|
|
1314
|
-
H5Props,
|
|
1315
|
-
H6Props,
|
|
1316
|
-
PProps,
|
|
1317
|
-
SpanProps,
|
|
1318
|
-
CodeProps,
|
|
1319
|
-
SmallProps,
|
|
1320
|
-
StrongProps,
|
|
1321
|
-
LeadProps,
|
|
1322
|
-
AProps,
|
|
1323
|
-
BlockquoteProps,
|
|
1324
|
-
};
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* Type export for CVA variant props
|
|
1328
|
-
*/
|
|
1329
|
-
export type { VariantProps as TypographyVariantProps } from "class-variance-authority";
|