Skip to content

Commit 5d4c385

Browse files
V3 Redesign (#5851)
* fix(docs): update Link component to use Link.Root for consistency with new component structure * feat: light theme in progress, button, spearator & accordion adjusted to new default theme * feat: button and chip done * feat: enhance Skeleton component with new Grid and Single Shimmer previews; update card and disclosure styles for consistency * feat: update Kbd component styles and add Abbr support in stories * feat: avatar and chip updated * fix(accordion): adjust separator styling for consistency in accordion items * refactor: close button adjsuted * feat(link): add underline variants and offset options to Link component documentation and implementation * feat(link): enhance link component with hover state and transition effects for icon opacity * refactor: surfaces variables are now calculated by default, card, button, disclosures updated * refactor: update styles for various components to improve consistency and reduce motion effects * feat(storybook): add welcome story and update story order; feat(styles): include variants in package config and copy script * refactor: update accordion, card, and kbd components to enhance styling and introduce new variants * refactor(link): update hover underline effect to use opacity transition instead of scale transformation * refactor(styles): update background color variables and remove gradient backgrounds from layout components * refactor(storybook): enhance color stories by adding calculated color variants and removing deprecated soft colors * refactor(styles): introduce background quaternary color and update shadow variables for popover and tooltip components * feat: alert component created * refactor(alert-demo, x-profile-demo): simplify button usage and enhance layout alignment * feat: input otp * feat: inpuit otp docs * refactor(switch): enhance styling with improved transition timings and add box-shadow for active states * feat: home page design in progress * feat: add Surface component with context-based on-surface styling - Add Surface component with four variants (default, secondary, tertiary, quaternary) - Implement SurfaceContext to provide variant to child components - Update Input, TextArea, InputOTP, and RadioGroup to automatically detect Surface context - Components now apply on-surface styling when wrapped in Surface component - Add OnSurface stories for all affected components - Create comprehensive Surface documentation with examples - Add OnSurface demo examples to all component documentation pages - Update CSS classes to support on-surface modifier variants * feat: add Surface component documentation and update meta.json * feat(card): implement form handling in WithForm story using Form, Input, and Label components * feat(card): refactor WithForm to use Form component for improved form handling and submission * refactor(accordion): remove background class from stories and enhance AccordionRoot with SurfaceContext for elevated variant * refactor(accordion): update variant from elevated to surface across components and documentation * feat: add checkbox-group component and checkbox enhancements * feat(demo): add UIComponentsDemo to the DemoComponents * refactor: migrate Component.Root to Component in docs and demos - Update all component documentation files to use Component instead of Component.Root - Update all demo files to use simplified component syntax - Update API reference headers from Component.Root Props to Component Props - Exclude changelog files from migration as requested This change promotes the simpler and more elegant Component syntax while maintaining backward compatibility (both patterns are still supported). * style: update global styles and card component * feat(storybook): enhance color stories with new "On Surface" color variants and remove obsolete field color states * feat(demos): update chip component props from 'type' to 'color' and add "use client" directive in multiple demo files * feat(demos): add "use client" directive to basic button demo * refactor: theme variables update background color in dark mode * feat(demos): add "use client" directive to multiple demo files * feat(demos): add FieldError component to TextfieldDemo for improved validation feedback * fix(demo): update avatar images and names in avatar-group-demo for consistency * feat: listbox component preview created and documented * feat: selecte component created * feat: export React Aria components from rac module * feat: slider component created, documentation styles and content updated. Home page completed * fix(demo): correct spelling of "credits" in AlertDemo component * refactor(docs): simplify component usage by using compound pattern (#5870) * fix(component): checkbox build errors * refactor(docs): simplify component usage by using compound pattern * fix(component): checkbox build errors * chore(docs): correct pattern description * feat(docs): enhance component preview with intersection observer for lazy loading * feat(docs): enhance code block styling and functionality with isolated rendering option * chore(root): upgrade package manager * fix(docs): update image sources and enhance styling across various components --------- Co-authored-by: Tianen Pang <[email protected]>
1 parent 91f1905 commit 5d4c385

File tree

402 files changed

+14664
-4389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

402 files changed

+14664
-4389
lines changed

.claude/agents/tailwind-v4-css-expert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You communicate technical concepts clearly and can assist both human developers
5252

5353
```css
5454
/* Good */
55-
@apply bg-panel rounded-lg border p-4 shadow-md;
55+
@apply bg-surface rounded-lg border p-4 shadow-md;
5656
```
5757

5858
2. **Keep custom CSS properties**: Don't convert properties without Tailwind utilities

.claude/guides/tailwindcss-v4-css-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ Tailwind CSS v4 embraces CSS custom properties for theming and dynamic values:
343343
```css
344344
.component {
345345
/* Good: Use @apply for Tailwind utilities */
346-
@apply bg-panel rounded-lg border p-4 shadow-md;
346+
@apply bg-surface rounded-lg border p-4 shadow-md;
347347

348348
/* Keep custom CSS for non-utility properties */
349349
cursor: var(--cursor-interactive);

apps/docs/content/docs/components/accordion.mdx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Accordion
33
description: A collapsible content panel for organizing information in a compact space
4-
icon: updated
54
links:
65
rac: Disclosure
76
source: accordion/accordion.tsx
@@ -31,7 +30,7 @@ Import the Accordion component and access all parts using dot notation.
3130
import { Accordion } from '@heroui/react';
3231

3332
export default () => (
34-
<Accordion.Root>
33+
<Accordion>
3534
<Accordion.Item>
3635
<Accordion.Heading>
3736
<Accordion.Trigger>
@@ -42,7 +41,7 @@ export default () => (
4241
<Accordion.Body/>
4342
</Accordion.Panel>
4443
</Accordion.Item>
45-
</Accordion.Root>
44+
</Accordion>
4645
)
4746
```
4847

@@ -120,7 +119,7 @@ const items = [
120119
121120
export function CustomStyles() {
122121
return (
123-
<Accordion.Root className="bg-surface-1 w-full max-w-md rounded-2xl" variant="outline">
122+
<Accordion className="bg-surface-secondary w-full max-w-md rounded-2xl" variant="surface">
124123
{items.map((item, index) => (
125124
<Accordion.Item
126125
key={index}
@@ -131,7 +130,7 @@ export function CustomStyles() {
131130
)}
132131
>
133132
<Accordion.Heading>
134-
<Accordion.Trigger className="hover:bg-surface-2 group flex items-center gap-2">
133+
<Accordion.Trigger className="hover:bg-surface-tertiary group flex items-center gap-2">
135134
{item.iconUrl ? (
136135
<img
137136
alt={item.title}
@@ -153,7 +152,7 @@ export function CustomStyles() {
153152
</Accordion.Panel>
154153
</Accordion.Item>
155154
))}
156-
</Accordion.Root>
155+
</Accordion>
157156
);
158157
}`} />
159158

@@ -211,7 +210,7 @@ The component supports both CSS pseudo-classes and data attributes for flexibili
211210

212211
## API Reference
213212

214-
### Accordion.Root Props
213+
### Accordion Props
215214

216215
| Prop | Type | Default | Description |
217216
|------|------|---------|-------------|
@@ -220,7 +219,7 @@ The component supports both CSS pseudo-classes and data attributes for flexibili
220219
| `expandedKeys` | `Iterable<Key>` | - | The controlled expanded keys |
221220
| `onExpandedChange` | `(keys: Set<Key>) => void` | - | Handler called when expanded keys change |
222221
| `isDisabled` | `boolean` | `false` | Whether the entire accordion is disabled |
223-
| `variant` | `"default" \| "outline"` | `"default"` | The visual variant of the accordion |
222+
| `variant` | `"default" \| "surface"` | `"default"` | The visual variant of the accordion |
224223
| `className` | `string` | - | Additional CSS classes |
225224
| `children` | `ReactNode` | - | The accordion items |
226225

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
title: Alert
3+
description: Display important messages and notifications to users with status indicators
4+
icon: new
5+
links:
6+
source: alert/alert.tsx
7+
styles: alert.css
8+
storybook: alert
9+
figma: true
10+
---
11+
12+
## Import
13+
14+
```tsx
15+
import { Alert } from '@heroui/react';
16+
```
17+
18+
### Usage
19+
20+
<ComponentPreview
21+
name="alert-basic"
22+
/>
23+
24+
25+
### Anatomy
26+
27+
Import the Alert component and access all parts using dot notation.
28+
29+
```tsx
30+
import { Alert } from '@heroui/react';
31+
32+
export default () => (
33+
<Alert>
34+
<Alert.Indicator />
35+
<Alert.Content>
36+
<Alert.Title />
37+
<Alert.Description />
38+
</Alert.Content>
39+
</Alert>
40+
)
41+
```
42+
43+
<RelatedComponents component="alert" />
44+
45+
## Styling
46+
47+
### Passing Tailwind CSS classes
48+
49+
```tsx
50+
import { Alert } from "@heroui/react";
51+
52+
function CustomAlert() {
53+
return (
54+
<Alert className="border-2 border-blue-500 rounded-xl" status="accent">
55+
<Alert.Indicator className="text-blue-600" />
56+
<Alert.Content className="gap-1">
57+
<Alert.Title className="font-bold text-lg">Custom Alert</Alert.Title>
58+
<Alert.Description className="text-sm opacity-80">
59+
This alert has custom styling applied
60+
</Alert.Description>
61+
</Alert.Content>
62+
</Alert>
63+
);
64+
}
65+
```
66+
67+
### Customizing the component classes
68+
69+
To customize the Alert component classes, you can use the `@layer components` directive.
70+
<br/>[Learn more](https://tailwindcss.com/docs/adding-custom-styles#adding-component-classes).
71+
72+
```css
73+
@layer components {
74+
.alert {
75+
@apply rounded-2xl shadow-lg;
76+
}
77+
78+
.alert__title {
79+
@apply font-bold text-lg;
80+
}
81+
82+
.alert--danger {
83+
@apply border-l-4 border-red-600;
84+
}
85+
}
86+
```
87+
88+
HeroUI follows the [BEM](https://getbem.com/) methodology to ensure component variants and states are reusable and easy to customize.
89+
90+
### CSS Classes
91+
92+
The Alert component uses these CSS classes ([View source styles](https://github.com/heroui-inc/heroui/blob/v3/packages/styles/components/alert.css)):
93+
94+
#### Base Classes
95+
- `.alert` - Base alert container
96+
- `.alert__indicator` - Icon/indicator container
97+
- `.alert__content` - Content wrapper for title and description
98+
- `.alert__title` - Alert title text
99+
- `.alert__description` - Alert description text
100+
101+
#### Status Variant Classes
102+
- `.alert--default` - Default gray status
103+
- `.alert--accent` - Accent blue status
104+
- `.alert--success` - Success green status
105+
- `.alert--warning` - Warning yellow/orange status
106+
- `.alert--danger` - Danger red status
107+
108+
### Interactive States
109+
110+
The Alert component is primarily informational and doesn't have interactive states on the base component. However, it can contain interactive elements like buttons or close buttons.
111+
112+
## API Reference
113+
114+
### Alert Props
115+
116+
| Prop | Type | Default | Description |
117+
|------|------|---------|-------------|
118+
| `status` | `"default" \| "accent" \| "success" \| "warning" \| "danger"` | `"default"` | The visual status of the alert |
119+
| `asChild` | `boolean` | `false` | Merge props onto the child element |
120+
| `className` | `string` | - | Additional CSS classes |
121+
| `children` | `ReactNode` | - | The alert content |
122+
123+
### Alert.Indicator Props
124+
125+
| Prop | Type | Default | Description |
126+
|------|------|---------|-------------|
127+
| `asChild` | `boolean` | `false` | Merge props onto the child element |
128+
| `className` | `string` | - | Additional CSS classes |
129+
| `children` | `ReactNode` | - | Custom indicator icon (defaults to status icon) |
130+
131+
### Alert.Content Props
132+
133+
| Prop | Type | Default | Description |
134+
|------|------|---------|-------------|
135+
| `asChild` | `boolean` | `false` | Merge props onto the child element |
136+
| `className` | `string` | - | Additional CSS classes |
137+
| `children` | `ReactNode` | - | Content (typically Title and Description) |
138+
139+
### Alert.Title Props
140+
141+
| Prop | Type | Default | Description |
142+
|------|------|---------|-------------|
143+
| `asChild` | `boolean` | `false` | Merge props onto the child element |
144+
| `className` | `string` | - | Additional CSS classes |
145+
| `children` | `ReactNode` | - | The alert title text |
146+
147+
### Alert.Description Props
148+
149+
| Prop | Type | Default | Description |
150+
|------|------|---------|-------------|
151+
| `asChild` | `boolean` | `false` | Merge props onto the child element |
152+
| `className` | `string` | - | Additional CSS classes |
153+
| `children` | `ReactNode` | - | The alert description text |

apps/docs/content/docs/components/avatar.mdx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Avatar
33
description: Display user profile images with customizable fallback content
4-
icon: updated
54
links:
65
radix: avatar
76
source: avatar/avatar.tsx
@@ -28,10 +27,10 @@ Import the Avatar component and access all parts using dot notation.
2827
import { Avatar } from '@heroui/react';
2928

3029
export default () => (
31-
<Avatar.Root>
30+
<Avatar>
3231
<Avatar.Image/>
3332
<Avatar.Fallback/>
34-
</Avatar.Root>
33+
</Avatar>
3534
)
3635
```
3736

@@ -43,6 +42,10 @@ export default () => (
4342

4443
<ComponentPreview name="avatar-colors" />
4544

45+
### Variants
46+
47+
<ComponentPreview name="avatar-variants" />
48+
4649
### Fallback Content
4750

4851
<ComponentPreview name="avatar-fallback" />
@@ -64,10 +67,10 @@ import { Avatar } from '@heroui/react';
6467

6568
function CustomAvatar() {
6669
return (
67-
<Avatar.Root className="size-20">
70+
<Avatar className="size-20">
6871
<Avatar.Image src="..." alt="..." />
6972
<Avatar.Fallback>XL</Avatar.Fallback>
70-
</Avatar.Root>
73+
</Avatar>
7174
);
7275
}
7376
```
@@ -105,6 +108,9 @@ The Avatar component uses these CSS classes ([View source styles](https://github
105108
- `.avatar--md` - Medium avatar (default, no additional styles)
106109
- `.avatar--lg` - Large avatar (size-12)
107110

111+
#### Variant Modifiers
112+
- `.avatar--soft` - Soft variant with lighter background
113+
108114
#### Color Modifiers
109115
- `.avatar__fallback--default` - Default text color
110116
- `.avatar__fallback--accent` - Accent text color
@@ -114,12 +120,13 @@ The Avatar component uses these CSS classes ([View source styles](https://github
114120

115121
## API Reference
116122

117-
### Avatar.Root Props
123+
### Avatar Props
118124

119125
| Prop | Type | Default | Description |
120126
|------|------|---------|-------------|
121127
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Avatar size |
122128
| `color` | `'default' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | `'default'` | Fallback color theme |
129+
| `variant` | `'default' \| 'soft'` | `'default'` | Visual style variant |
123130
| `className` | `string` | - | Additional CSS classes |
124131
| `asChild` | `boolean` | `false` | Render as child element |
125132

0 commit comments

Comments
 (0)