Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion packages/dev/s2-docs/pages/s2/ActionBar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let rows = [

function Example(props) {
return (
<TableView
<TableView
aria-label="Table with action bar"
selectionMode="multiple"
defaultSelectedKeys={[2]}
Expand Down
32 changes: 31 additions & 1 deletion packages/dev/s2-docs/pages/s2/ActionButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import docs from 'docs:@react-spectrum/s2';
<VisualExample
component={ActionButton}
docs={docs.exports.ActionButton}
props={['children', 'size', 'staticColor', 'isQuiet', 'isDisabled']}
props={['children', 'size', 'staticColor', 'isQuiet', 'isDisabled', 'isPending']}
initialProps={{children: 'Action'}}
slots={{icon: true, avatar: true, badge: true}}
importSource="@react-spectrum/s2"
Expand Down Expand Up @@ -39,6 +39,36 @@ function Example() {
}
```

## Pending

Use the `isPending` prop to display a pending state. Pending buttons remain focusable, but are otherwise disabled. After a 1 second delay, an indeterminate spinner will be displayed in place of the button label and icon.

```tsx render
"use client";
import {ActionButton} from '@react-spectrum/s2';
import {useState} from 'react';

function PendingButton() {
let [isPending, setPending] = useState(false);

return (
<ActionButton
variant="primary"
///- begin highlight -///
isPending={isPending}
///- end highlight -///
onPress={() => {
setPending(true);
setTimeout(() => {
setPending(false);
}, 5000);
}}>
Save
</ActionButton>
);
}
```

## API

```tsx links={{ActionButton: '#actionbutton', Avatar: 'Avatar.html'}}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-aria-components/docs/Toast.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ There is no built in way to display toast notifications in HTML. `<ToastRegion>`

<Anatomy role="img" aria-label="Toast anatomy diagram, showing the toast's title and close button within the toast region." />

A `<ToastRegion>` is an [ARIA landmark region](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/) labeled "Notifications" by default. A `<ToastRegion>` accepts a function to render one or more visible toasts, in chronological order. When the limit is reached, additional toasts are queued until the user dismisses one. Each `<Toast>` is a non-modal ARIA [alertdialog](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/), containing the content of the notification and a close button.
A `<ToastRegion>` is an [ARIA landmark region](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/) labeled "Notifications" by default. A `<ToastRegion>` accepts a function to render one or more visible toasts, in chronological order. When the limit is reached, additional toasts are queued until the user dismisses one. Each `<Toast>` is a non-modal ARIA [alertdialog](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/), containing the content of the notification and a close button. The toast's content gets announced by screen readers when the toast appears, so it is recommended to render the close button as a sibling of `<ToastContent>` instead of inside it, but this is not a requirement.

Landmark regions including the toast container can be navigated using the keyboard by pressing the <Keyboard>F6</Keyboard> key to move forward, and the <Keyboard>Shift</Keyboard> + <Keyboard>F6</Keyboard> key to move backward. This provides an easy way for keyboard users to jump to the toasts from anywhere in the app. When the last toast is closed, keyboard focus is restored.

Expand Down
Loading