Icon Button
Use icon buttons for compact, accessible icon-only interactions. Icon buttons are essential for space-efficient interfaces while maintaining accessibility compliance.Use icon buttons for compact, accessible icon-only interactions. Icon buttons are essential for space-efficient interfaces while maintaining accessibility compliance.
This is an enhanced version of the IconButton component from Radix Themes. For the original API reference, see the Radix Themes IconButton documentation.
Playground
Installation
Usage
Props
Accessibility Requirements
Icon buttons must have an accessible name to meet WCAG guidelines. Provide accessibility through one of these methods:
aria-label
Direct descriptive text that explains the button's action.
aria-labelledby
Reference to a label element for more complex descriptions.
Visible Text Children
Fallback when visible text is included alongside the icon.
Variants
Use the variant prop to set button style.
Classic
Elevated style with subtle shadow for maximum visual impact.
Solid
Filled background for primary actions.
Soft
Subtle background for secondary actions.
Outline
Bordered style for secondary actions.
Surface
Elevated surface for content-heavy UIs.
Ghost
Minimal style for utility actions.
Sizes
Set size for button density. Icon buttons maintain square aspect ratios for consistent visual alignment.
Size 1
Compact for toolbars and dense interfaces.
Size 2
Standard for most interface contexts.
Size 3
Large for important actions and mobile touch targets.
Size 4
Extra large for hero sections and maximum impact.
Colors
Use the color prop with semantic colors to communicate action intent.
Tooltips
Use the tooltip prop to add context to icon button actions. Always provide a tooltip for icon-only buttons to help users understand the action.
Tooltip Position
Control tooltip placement with tooltipSide and tooltipAlign props.
States
Loading
Set loading to show a spinner and disable the button.
Disabled
Set disabled to prevent interaction.
Polymorphism
As
Use the as prop to render as different HTML elements while maintaining icon button styling.
AsChild
Use the asChild prop to merge props with a child element using the Radix Slot pattern.
Responsive
Use responsive objects with the size prop to adapt sizing across breakpoints.
Accessibility
Kookie UI's IconButton enforces accessibility requirements with runtime validation.
Enforced Accessible Name
IconButton throws an error in development if no accessible name is provided. This ensures WCAG compliance and catches accessibility issues early.
Keyboard Navigation
- Full keyboard support with Enter and Space keys
- Visible focus indicators for all variants
- Enhanced focus management for Windows High Contrast mode
Screen Readers
- Semantic button elements with proper roles
- Loading state announcements
- Tooltip associations via
aria-describedby - Disabled state announcements
Enhancements
Kookie UI extends Radix Themes IconButton with practical improvements:
Built-in Tooltip Support
Native tooltip prop eliminates need for wrapper components. Tooltips automatically provide accessibility through aria-describedby associations.
Runtime Accessibility Validation
Enforced accessibility requirements with helpful error messages in development. Ensures all icon buttons have proper accessible names.
Enhanced Loading State
Loading state automatically disables interaction and displays spinner with proper accessibility announcements.
Changelog
Added
- Built-in tooltip support through
tooltip,tooltipSide,tooltipAlignprops - Runtime accessibility validation for missing accessible names
- New
materialprop for solid/translucent theme contexts - Enhanced form integration with complete HTML form attribute support
Changed
- Improved 3D shadow system for classic variant
- Better contrast relationships in both light and dark themes
Removed
highContrastprop. Gray fills with step 12 on its own, and icons read the strong ink by default.
Fixed
- Better color saturation and brightness in high contrast mode
- Enhanced focus indicators for improved accessibility
© 2026 Kushagra Dhawan. Licensed under MIT. GitHub.