A simple yet effective component for creating hamburger menu icons that can toggle between active and inactive states. NavIcon is commonly used in responsive navigation interfaces to indicate the presence of a menu.
NavIcon has two states: active and inactive, controlled by the active prop.
The NavIcon component accepts all the props of the Flex component, allowing for customization of size, spacing, and other properties.
The NavIcon component includes a tabIndex={0} by default, making it keyboard accessible. When implementing NavIcon in your application, consider the following accessibility best practices:
- Add an aria-label or aria-labelledby attribute to describe the purpose of the button
- Use aria-expanded to indicate the current state of the menu it controls
- Ensure the menu that is toggled by the NavIcon is properly accessible