MCPcopy Create free account
hub / github.com/adobe/react-spectrum / AIButton

Function AIButton

packages/@react-spectrum/s2/stories/SideNavAIButton.tsx:246–261  ·  view source on GitHub ↗
({size = 'M', brandColor, children, styles, ...otherProps}: AIButtonProps)

Source from the content-addressed store, hash-verified

244 * An AIButton triggers an AI-powered action with a customizable branded appearance.
245 */
246export function AIButton({size = 'M', brandColor, children, styles, ...otherProps}: AIButtonProps) {
247 let ref = useRef<HTMLButtonElement | null>(null);
248 return (
249 <Button
250 {...otherProps}
251 ref={ref}
252 className={renderProps => bg + mergeStyles(button({size, ...renderProps}), styles)}
253 // eslint-disable-next-line react/react-compiler
254 style={pressScale(ref, {'--brand': brandColor} as CSSProperties)}>
255 <IconContext.Provider value={{styles: style({size: fontRelative(16), flexShrink: 0})}}>
256 <AIIcon />
257 </IconContext.Provider>
258 {children && <span>{children}</span>}
259 </Button>
260 );
261}
262
263const AIIcon = createIcon(props => {
264 return (

Callers

nothing calls this directly

Calls 3

pressScaleFunction · 0.90
fontRelativeFunction · 0.90
mergeStylesFunction · 0.50

Tested by

no test coverage detected