Skip to content

chore: docs starter #8478

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8a38c43
initial commit
snowystinger Jul 2, 2025
6bd8d8b
use react 19 and runtime automatic
snowystinger Jul 2, 2025
c45fd91
use story types and remove extraneous My* exports
snowystinger Jul 2, 2025
ac7ef17
Share a few more components
snowystinger Jul 2, 2025
20c758c
make combobox like select
snowystinger Jul 2, 2025
a3e0c9a
Share popovers/dialogs where possible
snowystinger Jul 2, 2025
b7a0361
stop running extractExamples script
snowystinger Jul 2, 2025
deff1e9
re-add script so we can run typescript on docs examples still
snowystinger Jul 2, 2025
365f514
fix styles, use lucide icons, fix menu controls table
snowystinger Jul 2, 2025
ed72ccd
move to lucide icons, css fixes
snowystinger Jul 3, 2025
fb8eeb1
fix examples
snowystinger Jul 3, 2025
3417c47
fix toggle button css
snowystinger Jul 3, 2025
5d886e6
need to revert yarn.lock
snowystinger Jul 3, 2025
c135a69
revert yarn.lock
snowystinger Jul 3, 2025
17c7fe9
ignore yarn.lock again
snowystinger Jul 3, 2025
cb468b4
Merge branch 'main' into chore-docs-starter
snowystinger Jul 7, 2025
9401bc8
Merge branch 'main' into chore-docs-starter
snowystinger Jul 9, 2025
1ecced7
update icons sizes to be smaller
snowystinger Jul 9, 2025
1d8871e
make a few more icons smaller
snowystinger Jul 9, 2025
9108cc1
share more between components and simplify, review comments
snowystinger Jul 10, 2025
509f25b
Merge branch 'main' into chore-docs-starter
snowystinger Jul 10, 2025
6111a0a
fix css selector
snowystinger Jul 10, 2025
8daacd8
fix lint
snowystinger Jul 10, 2025
fd425b2
Merge branch 'main' into chore-docs-starter
snowystinger Jul 11, 2025
96af233
small fixes
devongovett Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ check-examples:
yarn tsc --project dist/docs-examples/tsconfig.json

starter:
node scripts/extractStarter.mjs
cd starters/docs && yarn --no-immutable && yarn tsc

starter-zip: starter
Expand Down
4 changes: 4 additions & 0 deletions packages/react-aria-components/docs/Button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ import {Button} from 'react-aria-components';
outline: none;
padding: 6px 10px;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 4px;

&[data-pressed] {
box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.1);
Expand Down
29 changes: 15 additions & 14 deletions packages/react-aria-components/docs/Calendar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ type: component

```tsx example
import {Calendar, Heading, Button, CalendarGrid, CalendarCell} from 'react-aria-components';
import {ChevronLeft, ChevronRight} from 'lucide-react';

<Calendar aria-label="Appointment date">
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -218,9 +219,9 @@ function MyCalendar<T extends DateValue>({errorMessage, ...props}: MyCalendarPro
return (
<Calendar {...props}>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -376,9 +377,9 @@ Multiple `CalendarGrid` elements can be rendered to show multiple months at once
```tsx example
<Calendar aria-label="Appointment date" visibleDuration={{months: 3}}>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<div style={{display: 'flex', gap: 30, overflow: 'auto'}}>
<CalendarGrid>
Expand All @@ -401,9 +402,9 @@ The `pageBehavior` prop allows you to control how the calendar navigates between
```tsx example
<Calendar aria-label="Appointment date" visibleDuration={{months: 3}} pageBehavior="single">
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<div style={{display: 'flex', gap: 30, overflow: 'auto'}}>
<CalendarGrid>
Expand Down Expand Up @@ -735,9 +736,9 @@ import {CalendarGridHeader, CalendarHeaderCell, CalendarGridBody} from 'react-ar

<Calendar aria-label="Appointment date">
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
<CalendarGridHeader>
Expand Down Expand Up @@ -920,9 +921,9 @@ function CalendarValue() {

<Calendar>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -966,9 +967,9 @@ function WeekCalendarGrid(props: CalendarGridProps) {
<Calendar visibleDuration={{weeks: 1}} defaultValue={today(getLocalTimeZone())}>
<div className="week">
<Heading />
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<WeekCalendarGrid />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</div>
</Calendar>
```
Expand Down
6 changes: 5 additions & 1 deletion packages/react-aria-components/docs/ColorSlider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ import {ColorSlider, ColorThumb, Label, SliderOutput, SliderTrack} from 'react-a

.react-aria-Label {
grid-area: label;
color: var(--text-color);
}

.react-aria-SliderOutput {
grid-area: output;
width: 4ch;
text-align: end;
color: var(--text-color);
}

.react-aria-SliderTrack {
Expand Down Expand Up @@ -190,7 +194,7 @@ export function MyColorSlider({label, ...props}: MyColorSliderProps) {
<ColorSlider {...props}>
<Label>{label}</Label>
<SliderOutput />
<SliderTrack
<SliderTrack
style={({defaultStyle}) => ({
background: `${defaultStyle.background},
repeating-conic-gradient(#CCC 0% 25%, white 0% 50%) 50% / 16px 16px`
Expand Down
15 changes: 10 additions & 5 deletions packages/react-aria-components/docs/ComboBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ type: component

```tsx example
import {ComboBox, Label, Input, Button, Popover, ListBox, ListBoxItem} from 'react-aria-components';
import {ChevronDown} from 'lucide-react';

<ComboBox>
<Label>Favorite Animal</Label>
<div>
<Input />
<Button></Button>
<Button><ChevronDown size={16} /></Button>
</div>
<Popover>
<ListBox>
Expand Down Expand Up @@ -338,7 +339,7 @@ function MyComboBox<T extends object>({label, description, errorMessage, childre
<Label>{label}</Label>
<div className="my-combobox-container">
<Input />
<Button></Button>
<Button><ChevronDown size={16} /></Button>
</div>
{description && <Text slot="description">{description}</Text>}
<FieldError>{errorMessage}</FieldError>
Expand Down Expand Up @@ -1114,7 +1115,7 @@ The `description` slot can be used to associate additional help text with a Comb
<Label>Favorite Animal</Label>
<div>
<Input />
<Button></Button>
<Button><ChevronDown size={16} /></Button>
</div>
{/*- begin highlight -*/}
<Text slot="description">Please select an animal.</Text>
Expand Down Expand Up @@ -1461,6 +1462,7 @@ This example shows a `ComboBoxClearButton` component that can be placed within a

```tsx example
import {ComboBoxStateContext} from 'react-aria-components';
import {X} from 'lucide-react';

function ComboBoxClearButton() {
/*- begin highlight -*/
Expand All @@ -1473,7 +1475,7 @@ function ComboBoxClearButton() {
className="clear-button"
aria-label="Clear"
onPress={() => state?.setSelectedKey(null)}>
<X size={14} />
</Button>
);
}
Expand All @@ -1485,7 +1487,7 @@ function ComboBoxClearButton() {
{/*- begin highlight -*/}
<ComboBoxClearButton />
{/*- end highlight -*/}
<Button></Button>
<Button><ChevronDown size={16} /></Button>
</div>
<Popover>
<ListBox>
Expand Down Expand Up @@ -1515,6 +1517,9 @@ function ComboBoxClearButton() {
border: none;
padding: 0;
outline: none;
display: flex;
align-items: center;
justify-content: center;

&[data-pressed] {
background: dimgray;
Expand Down
33 changes: 17 additions & 16 deletions packages/react-aria-components/docs/DatePicker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ type: component

```tsx example
import {DatePicker, Label, Group, Popover, Dialog, Calendar, CalendarGrid, CalendarCell, Button, Heading, DateInput, DateSegment} from 'react-aria-components';
import {ChevronDown, ChevronLeft, ChevronRight} from 'lucide-react';

<DatePicker>
<Label>Date</Label>
<Group>
<DateInput>
{segment => <DateSegment segment={segment} />}
</DateInput>
<Button></Button>
<Button><ChevronDown size={20} /></Button>
</Group>
<Popover>
<Dialog>
<Calendar>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -197,7 +198,7 @@ Note that most of this anatomy is shared with [DateRangePicker](DateRangePicker.

### Internationalization

To ensure the proper date and time format in RTL locales, `DateInput` must have `display` set to either `inline`, `inline-block`, or `block`.
To ensure the proper date and time format in RTL locales, `DateInput` must have `display` set to either `inline`, `inline-block`, or `block`.

### Concepts

Expand Down Expand Up @@ -305,17 +306,17 @@ function MyDatePicker<T extends DateValue>({label, description, errorMessage, fi
<DateInput>
{segment => <DateSegment segment={segment} />}
</DateInput>
<Button></Button>
<Button><ChevronDown size={20} /></Button>
</Group>
{description && <Text slot="description">{description}</Text>}
<FieldError>{errorMessage}</FieldError>
<Popover>
<Dialog>
<Calendar firstDayOfWeek={firstDayOfWeek}>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -507,7 +508,7 @@ import {Form, FieldError} from 'react-aria-components';
<DateInput>
{segment => <DateSegment segment={segment} />}
</DateInput>
<Button></Button>
<Button><ChevronDown size={20} /></Button>
</Group>
{/*- begin highlight -*/}
<FieldError />
Expand All @@ -516,9 +517,9 @@ import {Form, FieldError} from 'react-aria-components';
<Dialog>
<Calendar>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -646,7 +647,7 @@ The `description` slot can be used to associate additional help text with a date
<DateInput>
{segment => <DateSegment segment={segment} />}
</DateInput>
<Button></Button>
<Button><ChevronDown size={20} /></Button>
</Group>
{/*- begin highlight -*/}
<Text slot="description">Please select a weekday between 9 AM and 5 PM.</Text>
Expand All @@ -655,9 +656,9 @@ The `description` slot can be used to associate additional help text with a date
<Dialog>
<Calendar>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down Expand Up @@ -1148,15 +1149,15 @@ function DatePickerClearButton() {
{/*- begin highlight -*/}
<DatePickerClearButton />
{/*- end highlight -*/}
<Button></Button>
<Button><ChevronDown size={20} /></Button>
</Group>
<Popover>
<Dialog>
<Calendar>
<header>
<Button slot="previous"></Button>
<Button slot="previous"><ChevronLeft size={20} /></Button>
<Heading />
<Button slot="next"></Button>
<Button slot="next"><ChevronRight size={20} /></Button>
</header>
<CalendarGrid>
{date => <CalendarCell date={date} />}
Expand Down
Loading