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
9 changes: 8 additions & 1 deletion packages/@react-spectrum/ai/src/AIButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ export interface AIButtonProps extends Omit<
| 'isPending'
| keyof GlobalDOMAttributes
> {
/**
* The size of the AIButton.
*
* @default 'M'
*/
size?: 'S' | 'M' | 'L' | 'XL';
/** @private */
brandColor?: string;
/** The label to display in the AIButton. */
children?: string;
}

Expand Down Expand Up @@ -218,7 +225,7 @@ const bg = css(`
`);

/**
* An AIButton triggers an AI-powered action with a customizable branded appearance.
* An AIButton triggers an AI-powered action.
*/
export function AIButton({size = 'M', brandColor, children, ...otherProps}: AIButtonProps) {
let ref = useRef<HTMLButtonElement | null>(null);
Expand Down
4 changes: 4 additions & 0 deletions packages/dev/s2-docs/pages/s2/ai-component-helpers/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use client';

// Top-level MDX usage (e.g. VisualExample) needs client references, and @react-spectrum/ai isn't marked 'use client'.
export {AIButton} from '@react-spectrum/ai';
18 changes: 18 additions & 0 deletions packages/dev/s2-docs/pages/s2/ai-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {VersionBadge} from '../../src/VersionBadge';
import {AIIconsPageSearch} from '../../src/AIIconSearchView';
export default Layout;

import {AIButton} from './ai-component-helpers/client';
import docs from 'docs:@react-spectrum/ai';

export const section = 'Guides';
Expand Down Expand Up @@ -789,6 +790,19 @@ function GeneratingPrompt() {

<AIIconsPageSearch />

## AI buttons

`AIButton` triggers an AI-powered action, such as opening an assistant or generating content. It displays an AI icon alongside an optional label.

<VisualExample
component={AIButton}
docs={docs.exports.AIButton}
props={['children', 'size', 'isDisabled']}
initialProps={{children: 'Ask AI'}}
importSource="@react-spectrum/ai"
type="s2" />


## API

```tsx links={{Chat: '#chat', Thread: '#thread', ThreadItem: '#threaditem', PromptField: '#promptfield'}}
Expand Down Expand Up @@ -1059,3 +1073,7 @@ thumbnails within a `UserMessage`. Unlike `PromptFieldAttachmentList`, it does n
## PixelLoader

<PropTable component={docs.exports.PixelLoader} links={docs.links} showDescription />

## AIButton

<PropTable component={docs.exports.AIButton} links={docs.links} showDescription />