Files
heroui-inc--heroui/apps/docs/content/docs/changelog/v3-0-0-alpha-35.mdx
T
Junior Garcia 3c3f82432a Beta 1 [v3] (#5872)
* refactor: compound and named pattern (#5850)

* refactor(component): compound and named pattern

* refactor(component): tabs component naming consistency

* docs(changelog): v3.0.0-alpha-36

* fix(docs): correct broken storybook links (#5854)

* feat(components): checkbox (#5829)

* fix(component): support compound pattern in server component

* fix(component): keep accordion and chip in sync with compound pattern

* fix(component): type of forward refs

* fix(calendar): temporary workaround for ref error

* fix(storybook): imports

* feat(checkbox): initial draft

* refactor(styles): remove orientation

* refactor: migration from dot notation to separted components to support RSC

* refactor: migrate to React 19 ref pattern - remove forwardRef wrappers and explicit ref declarations from all components

* chore(checkbox): revise checkbox story

* feat(checkbox): checkmark & indeterminate

* chore(styles): checkmark & indeterminate styles

* refactor: provider context removed as it is not longer needed on react 19

* feat: made the migration smoother by still supporting the "dot" exports but adjusting the main compound component

* fix: compound patter, radio group api, ref on react 19

* refactor(switch): split switch and switch-group into separate components following radio/radio-group pattern

* chore(changelog): update v3.0.0-alpha.35 release notes and date

* fix(page): update version label to reflect RSC support

* chore(changelog): update examples to use new component names CardRoot and TabsRoot

* refactor(checkbox): adopt latest component structure

* chore: remove radio stories

* refactor(checkbox): adopt new api and revised stories

* refactor(checkbox-group): adopt new api and add stories

* chore(checkbox-group): revise examples

* chore(checkbox): separate checkbox group css

* chore(styles): revise checkbox styels

* fix(styles): add border for invalid

* feat(checkbox): add invalid story

* chore: sync changes from v3 redesign

* refactor(checkbox): remove slots

* refactor(checkbox): apply compound and named pattern

* feat(docs): checkbox page

* refactor(checkbox): remove use client

* chore(docs): revise based on the latest revamp

---------

Co-authored-by: Tianen Pang <32772271+tianenpang@users.noreply.github.com>
Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* 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 <32772271+tianenpang@users.noreply.github.com>

* fix(docs): update Twitter card image and adjust styles in route component for improved readability

* refactor(docs): updated color documentation

* fix(docs): update icon import in home page and remove unused client directive from Iconify component

* chore(docs): update documentation to reflect beta status and adjust storybook links for components

* feat: fix alert responsive

* feat(docs): replace img tags with next/image component for improved performance and consistency in home page and demo components

* fix: improve Lighthouse performance scores

- Replace picture/source elements with Next.js Image component
- Add fetchPriority='high' and loading='eager' to LCP images
- Fix viewport: remove userScalable: false and increase maximumScale to 5
- Add robots metadata with index: true for proper SEO
- Update sitemap URL in robots.txt

* fix: explicitly set X-Robots-Tag header to ensure proper indexing

- Add headers function in next.config.ts to set X-Robots-Tag: index, follow
- This ensures the header is explicitly set and prevents noindex issues

* fix(docs): update Link component styling in home page for improved visibility

* feat: card demos adjusted

* fix(docs): update introduction images for consistency and improved presentation

* fix(docs): update image sources in introduction and README for consistency

* fix(docs): update card component to include icon property for enhanced documentation

* fix(docs): update icon property for ListBox, Select, Slider, and MCP Server components to 'new' for improved documentation clarity

* fix(docs): update card demo layout to use flex-wrap for improved responsiveness

* feat(docs): implement changelog filtering in search API response

* feat: beta-1 changelog (draft)

* fix(docs): update version label in home page to reflect major redesign

* feat(docs): update changelog for v3-0-0-beta-1 with new components and improved API details

* fix(docs): correct formatting in changelog for v3-0-0-beta-1

* chore(docs): minor changes on v3 beta doc (#5879)

* chore(docs): update release date

* chore(docs): point to v3 component doc instead of v2

* chore(docs): add updated icon

* fix(input): typo

* refactor(styles): reduce motion (#5873)

* refactor(styles): reduce motion

* refactor(styles): reduce motion

* docs(handbook): disabling animations in animation section

* style(component): extend motion-reduce and adjust motion priority

* docs(handbook): disabling animations in animation section

* chore(docs): update design principles and changelog for v3-0-0-beta-1

* feat(docs): enhance HomePage and DocsImage components with static rendering and improved image handling

* fix(docs): update background colors for input, textarea, skeleton components and tabs in showcase

---------

Co-authored-by: Tianen Pang <32772271+tianenpang@users.noreply.github.com>
Co-authored-by: WK <wingkwong.code@gmail.com>
2025-11-06 11:08:05 -03:00

402 lines
12 KiB
Plaintext

---
title: v3.0.0-alpha.35
description: React Server Components support for compound components, React 19 improvements, and critical bug fixes.
---
<div className="flex items-center gap-3 mb-6">
<span className="text-sm text-muted">October 21, 2025</span>
</div>
This release fixes a critical issue where **compound components didn't work correctly in React Server Components (RSC)**. Additionally, this release adopts React 19 best practices by removing `forwardRef` and simplifying context usage. The Switch component has been refactored to match the Radio/RadioGroup pattern, providing a cleaner and more consistent API.
## Installation
Update to the latest version:
<Tabs items={["npm", "pnpm", "yarn", "bun"]}>
<Tab value="npm">
```bash
npm i @heroui/styles@alpha @heroui/react@alpha
```
</Tab>
<Tab value="pnpm">
```bash
pnpm add @heroui/styles@alpha @heroui/react@alpha
```
</Tab>
<Tab value="yarn">
```bash
yarn add @heroui/styles@alpha @heroui/react@alpha
```
</Tab>
<Tab value="bun">
```bash
bun add @heroui/styles@alpha @heroui/react@alpha
```
</Tab>
</Tabs>
<Callout type="info">
**Using AI assistants?** Simply prompt "Hey Cursor, update HeroUI to the latest version" and your AI assistant will automatically compare versions and apply the necessary changes. Learn more about the [HeroUI MCP Server](/docs/ui-for-agents/mcp-server).
</Callout>
## What's New
### React Server Components Support
Compound components now work correctly in React Server Components. The previous implementation had the compound pattern logic inside components, which conflicted with the `"use client"` directive. This has been fixed by moving the pattern logic to component index files.
### React 19 Improvements
This release adopts React 19 best practices:
1. **Removed `forwardRef`**: No longer needed in React 19, where `ref` is now a prop ([React 19 docs](https://react.dev/blog/2024/12/05/react-19#ref-as-a-prop))
2. **Simplified Context**: `Context.Provider` replaced with just `Context` ([React 19 docs](https://react.dev/blog/2024/12/05/react-19#context-as-a-provider))
### Switch Component Architecture Improvement
The Switch component has been refactored to follow the same clean separation pattern as Radio/RadioGroup:
- **Separate Components**: Switch and SwitchGroup are now independent components (previously combined)
- **Cleaner API**: `<SwitchGroup>` replaces the nested `<Switch.Group>` and `<Switch.GroupItems>` pattern
- **Better Organization**: Separate styles, types, and implementations for each component
- **Consistent Pattern**: Matches the Radio/RadioGroup architecture for a more predictable API
**Before:**
```tsx
<Switch.Group>
<Switch.GroupItems>
<Switch.Root>...</Switch.Root>
</Switch.GroupItems>
</Switch.Group>
```
**After:**
```tsx
<SwitchGroup>
<Switch.Root>...</Switch.Root>
<Switch.Root>...</Switch.Root>
</SwitchGroup>
```
## ⚠️ Breaking Changes
### Main Component Requires `.Root` Suffix
To support React Server Components, the compound component pattern has been restructured. The main component now requires the `.Root` suffix when using the compound pattern.
**Before:**
```tsx
import { Avatar } from "@heroui/react"
<Avatar>
<Avatar.Image src="/images/avatar.jpeg" alt="Junior Garcia" />
<Avatar.Fallback>JR</Avatar.Fallback>
</Avatar>
```
**After:**
```tsx
import { Avatar } from "@heroui/react"
<Avatar.Root>
<Avatar.Image src="/images/avatar.jpeg" alt="Junior Garcia" />
<Avatar.Fallback>JR</Avatar.Fallback>
</Avatar.Root>
```
**Note:** Named exports (e.g., `<Avatar>`, `<AvatarImage>`, `<AvatarFallback>`) remain unchanged and fully supported.
### Switch Component API Changes
The Switch component grouping API has been restructured to match the Radio/RadioGroup pattern:
**Before:**
```tsx
import { Switch } from "@heroui/react"
<Switch.Group orientation="horizontal">
<Switch.GroupItems>
<Switch.Root name="notifications">
<Switch.Control>
<Switch.Thumb />
</Switch.Control>
<Label>Notifications</Label>
</Switch.Root>
<Switch.Root name="marketing">
<Switch.Control>
<Switch.Thumb />
</Switch.Control>
<Label>Marketing</Label>
</Switch.Root>
</Switch.GroupItems>
</Switch.Group>
```
**After:**
```tsx
import { Switch, SwitchGroup } from "@heroui/react"
<SwitchGroup orientation="horizontal">
<Switch.Root name="notifications">
<Switch.Control>
<Switch.Thumb />
</Switch.Control>
<Label>Notifications</Label>
</Switch.Root>
<Switch.Root name="marketing">
<Switch.Control>
<Switch.Thumb />
</Switch.Control>
<Label>Marketing</Label>
</Switch.Root>
</SwitchGroup>
```
This change helps to:
- **Separate Components**: Switch and SwitchGroup are now independent components (previously combined)
- **Cleaner API**: `<SwitchGroup>` replaces the nested `<Switch.Group>` and `<Switch.GroupItems>` pattern
- **Better Organization**: Separate styles, types, and implementations for each component
- **Consistent Pattern**: Matches the Radio/RadioGroup architecture for a more predictable API
**Migration Steps:**
1. Import `SwitchGroup` separately: `import { Switch, SwitchGroup } from "@heroui/react"`
2. Replace `<Switch.Group>` with `<SwitchGroup>`
3. Remove the nested `<Switch.GroupItems>` wrapper
4. Individual `Switch.Root` components remain unchanged
#### Affected Components
All compound components are affected:
- `Accordion` → `Accordion.Root`
- `Avatar` → `Avatar.Root`
- `Card` → `Card.Root`
- `Disclosure` → `Disclosure.Root`
- `Fieldset` → `Fieldset.Root`
- `Kbd` → `Kbd.Root`
- `Link` → `Link.Root`
- `Popover` → `Popover.Root`
- `RadioGroup` → `RadioGroup.Root`
- `Switch` → `Switch.Root`
- `Tabs` → `Tabs.Root`
- `Tooltip` → `Tooltip.Root`
## Migration Guide
You have two options for using HeroUI compound components:
### Option 1: Update to Use `.Root` (Compound Pattern)
If you're using the compound pattern (dot notation), update your code to use `.Root` for the main component:
**Card Example:**
```tsx
import { Card } from "@heroui/react"
<Card.Root>
<Card.Header>
<Card.Title>Card Title</Card.Title>
<Card.Description>Card description</Card.Description>
</Card.Header>
<Card.Content>
Card content
</Card.Content>
<Card.Footer>
Card footer
</Card.Footer>
</Card.Root>
```
**Tabs Example:**
```tsx
import { Tabs } from "@heroui/react"
<Tabs.Root>
<Tabs.ListWrapper>
<Tabs.List>
<Tabs.Tab id="tab1">Tab 1<Tabs.Indicator /></Tabs.Tab>
<Tabs.Tab id="tab2">Tab 2<Tabs.Indicator /></Tabs.Tab>
</Tabs.List>
</Tabs.ListWrapper>
<Tabs.Panel id="tab1">Panel 1</Tabs.Panel>
<Tabs.Panel id="tab2">Panel 2</Tabs.Panel>
</Tabs.Root>
```
[See more examples in the documentation](/docs/components/card)
**Avatar Example:**
```tsx
import { Avatar } from "@heroui/react"
<Avatar.Root>
<Avatar.Image alt="John Doe" src="..." />
<Avatar.Fallback>JD</Avatar.Fallback>
</Avatar.Root>
```
[See more examples in the documentation](/docs/components/avatar)
### Option 2: Use Named Exports
We added support for named exports for all compound components. You can use them like this:
**Card Example:**
```tsx
import {
CardRoot,
CardHeader,
CardTitle,
CardDescription,
CardContent,
CardFooter,
} from "@heroui/react"
<CardRoot>
<CardHeader>
<CardTitle>Card Title</CardTitle>
<CardDescription>Card description</CardDescription>
</CardHeader>
<CardContent>
Card content
</CardContent>
<CardFooter>
Card footer
</CardFooter>
</CardRoot>
```
**Tabs Example:**
```tsx
import { TabsRoot, TabListContainer, TabList, Tab, TabIndicator, TabPanel } from "@heroui/react"
<TabsRoot>
<TabListContainer>
<TabList>
<Tab id="tab1">Tab 1<TabIndicator /></Tab>
<Tab id="tab2">Tab 2<TabIndicator /></Tab>
</TabList>
</TabListContainer>
<TabPanel id="tab1">Panel 1</TabPanel>
<TabPanel id="tab2">Panel 2</TabPanel>
</TabsRoot>
```
**Avatar Example:**
```tsx
import { Avatar, AvatarImage, AvatarFallback } from "@heroui/react"
<Avatar>
<AvatarImage alt="John Doe" src="..." />
<AvatarFallback>JD</AvatarFallback>
</Avatar>
```
### Migration Steps
If you're using the compound pattern, you only need to update the main component to use `.Root`:
1. **Find all instances of compound components** (e.g., `<Avatar>` with `<Avatar.Image>` inside)
2. **Add `.Root` to the main component**:
```tsx
// Before
<Avatar>
<Avatar.Image ... />
</Avatar>
// After
<Avatar.Root>
<Avatar.Image ... />
</Avatar.Root>
```
3. **That's it!** All child components (e.g., `Avatar.Image`, `Avatar.Fallback`) remain unchanged.
### Complete Migration Reference
| Component | Named Export Pattern | Compound Pattern (with `.Root`) | Additional Changes |
|-----------|---------------------|---------------------|---------------------|
| **Accordion** | `<Accordion>` | `<Accordion.Root>` | - |
| **Avatar** | `<Avatar>` | `<Avatar.Root>` | - |
| **Card** | `<Card>` | `<Card.Root>` | - |
| **Disclosure** | `<Disclosure>` | `<Disclosure.Root>` | - |
| **Fieldset** | `<Fieldset>` | `<Fieldset.Root>` | - |
| **Kbd** | `<Kbd>` | `<Kbd.Root>` | - |
| **Link** | `<Link>` | `<Link.Root>` | - |
| **Popover** | `<Popover>` | `<Popover.Root>` | - |
| **Radio** | `<Radio>` | `<Radio.Root>` | - |
| **Switch** | `<Switch>`, `<SwitchControl>` | `<Switch.Root>`, `<Switch.Control>` | `<Switch.Group>` → `<SwitchGroup>` (separate component) |
| **Tabs** | `<Tabs>`, `<TabList>` | `<Tabs.Root>`, `<Tabs.List>` | - |
| **Tooltip** | `<Tooltip>`, `<TooltipTrigger>` | `<Tooltip.Root>`, `<Tooltip.Trigger>` | - |
### Automated Migration
For large codebases using the compound pattern, you can use find-and-replace:
```bash
# Example for Avatar component
# Update the main component to use .Root
sed -i 's/<Avatar>/<Avatar.Root>/g' **/*.tsx
sed -i 's/<\/Avatar>/<\/Avatar.Root>/g' **/*.tsx
# Switch component requires additional steps
# First, ensure SwitchGroup is imported
# Then replace Switch.Group with SwitchGroup
sed -i 's/<Switch\.Group/<SwitchGroup/g' **/*.tsx
sed -i 's/<\/Switch\.Group>/<\/SwitchGroup>/g' **/*.tsx
# Remove Switch.GroupItems wrapper
sed -i 's/<Switch\.GroupItems>//g' **/*.tsx
sed -i 's/<\/Switch\.GroupItems>//g' **/*.tsx
# Repeat for other compound components (Card, Tabs, etc.)
# Note: This only affects files using the compound pattern
```
**Important:**
- Be careful with automated replacements. Make sure you're only replacing compound pattern usage, not named exports.
- For Switch migrations, verify that `SwitchGroup` is imported: `import { Switch, SwitchGroup } from "@heroui/react"`
- Test your code after running automated migrations to ensure all changes are correct.
## Why This Change?
This change was necessary to fix React Server Components compatibility. The previous implementation had architectural limitations:
1. **RSC Compatibility**: Compound pattern logic conflicted with `"use client"` directives
2. **React 19 Readiness**: Removes deprecated patterns like `forwardRef` and `Context.Provider`
3. **Cleaner Architecture**: Pattern logic is now in index files, not component files
4. **Better Separation**: Server and client components can now work together seamlessly
## Documentation Updates
Component documentation will be updated to reflect the new patterns:
- Examples will show the compound pattern with `.Root`
- Named export examples remain valid and supported
- Migration guides will help you transition smoothly
- Both patterns are fully supported and work identically
## Need Help?
If you encounter any issues during migration:
1. **Compound pattern users**: Update the main component to use `.Root` (e.g., `<Avatar>` → `<Avatar.Root>`)
2. **Named export users**: No changes needed - your code continues to work as-is
3. Check the component documentation for examples
4. Report issues at: [GitHub Issues](https://github.com/heroui-inc/heroui/issues)
## Links
- [Component Documentation](https://heroui.com/docs/components)
- [React Server Components](https://react.dev/reference/rsc/server-components)
- [React 19 Release](https://react.dev/blog/2024/12/05/react-19)
- [GitHub Repository](https://github.com/heroui-inc/heroui)
## Contributors
Thanks to everyone who contributed to this release, improving React Server Components support and React 19 compatibility!