tsimport {XDSIconButton} from '@xds/core/IconButton'
| Guidance | Practices |
|---|---|
| Do | Make the aria-label specific — a trash icon labeled "Delete conversation" is clearer than just "Delete" for screen readers. |
| Do | Add a tooltip — even a gear icon can mean Settings, Preferences, or Configure. |
| Do | Use ghost in toolbars and dense areas to reduce visual clutter. |
| Don't | Use IconButton if the action isn't obvious from the icon alone — use Button with text. |
| Don't | Skip the tooltip — label only reaches screen readers, sighted users need the hover hint. |
tsx'use client';import {XDSIconButton} from '@xds/core/IconButton';import {XDSIcon} from '@xds/core/Icon';import {XDSHStack} from '@xds/core/Stack';export default function IconButtactionBar() {return (<XDSHStack gap={1}><XDSIconButtonlabel="Search"icon={<XDSIcon icon="search" color="inherit" />}variant="ghost"/><XDSIconButtonlabel="Copy"icon={<XDSIcon icon="copy" color="inherit" />}variant="ghost"/><XDSIconButtonlabel="Info"icon={<XDSIcon icon="info" color="inherit" />}variant="ghost"/><XDSIconButtonlabel="Menu"icon={<XDSIcon icon="menu" color="inherit" />}variant="ghost"/><XDSIconButtonlabel="Close"icon={<XDSIcon icon="close" color="inherit" />}variant="ghost"/></XDSHStack>);}
tsx'use client';import {useState} from 'react';import {XDSIconButton} from '@xds/core/IconButton';import {XDSIcon} from '@xds/core/Icon';import {XDSHStack} from '@xds/core/Stack';export default function IconButtonLoadingToggle() {const [loadingId, setLoadingId] = useState<string | null>(null);function handleClick(id: string) {setLoadingId(id);setTimeout(() => setLoadingId(null), 1500);}return (<XDSHStack gap={2}><XDSIconButtonlabel="Copy"icon={<XDSIcon icon="copy" color="inherit" />}variant="primary"isLoading={loadingId === 'copy'}onClick={() => handleClick('copy')}/><XDSIconButtonlabel="Search"icon={<XDSIcon icon="search" color="inherit" />}isLoading={loadingId === 'search'}onClick={() => handleClick('search')}/><XDSIconButtonlabel="Close"icon={<XDSIcon icon="close" color="inherit" />}variant="ghost"isLoading={loadingId === 'close'}onClick={() => handleClick('close')}/></XDSHStack>);}
tsx'use client';import {XDSIconButton} from '@xds/core/IconButton';import {XDSIcon} from '@xds/core/Icon';import {XDSHStack} from '@xds/core/Stack';export default function IconButtonTooltipIconButton() {return (<XDSHStack gap={2}><XDSIconButtonlabel="Search"icon={<XDSIcon icon="search" color="inherit" />}variant="ghost"tooltip="Search items"/><XDSIconButtonlabel="Copy link"icon={<XDSIcon icon="copy" color="inherit" />}variant="ghost"tooltip="Copy to clipboard"/><XDSIconButtonlabel="More options"icon={<XDSIcon icon="moreHorizontal" color="inherit" />}variant="ghost"tooltip="More options"/></XDSHStack>);}
tsx'use client';import {XDSIconButton} from '@xds/core/IconButton';import {XDSIcon} from '@xds/core/Icon';export default function IconButtonShowcase() {return (<XDSIconButtonlabel="Settings"icon={<XDSIcon icon="wrench" color="inherit" />}/>);}