Skip to content
Enact

ui/ToggleIcon

An unstyled icon component that handles interaction and toggles state between activated and deactivated.

Visually, it may be to be customized by a theme or application to represent any state.

Represents a Boolean state, and can accept any icon to toggle.

Extends: ui/ToggleIconui/ToggleIcon.ToggleIconBase
Wrapped with: ui/ToggleIconui/ToggleIcon.ToggleIconDecorator

Properties

The handler to run when the component is toggled.

Represents a Boolean state, and can accept any icon to toggle.

Properties
StringObject

The icon to use for this component.


ObjectFunction

Called with a reference to the root component.

When using ui/ToggleIconui/ToggleIcon.ToggleIcon, the ref prop is forwarded to this component as componentRef.


Customizes the component by mapping the supplied collection of CSS class names to the corresponding internal elements and states of this component.

The following classes are supported:

  • toggleIcon - The root class name

  • icon - The background node of the button

  • selected - Applied to a selected button


Disables ToggleIcon.

Default: false

CSS classes to be used on the Icon component


StringComponent

The component used to render the icon.

Default: 'div'

Sets whether this control is in the 'on' or 'off' state. true for 'on', false for 'off'.

Default: false

Adds support for the onToggle prop callback to be fired when the onTap (touch-safe onClick) event executes.

Wrapped with: ui/ForwardRefui/ForwardRef.ForwardRef
Wrapped with: ui/Toggleableui/Toggleable.Toggleable
Wrapped with: ui/Touchableui/Touchable.Touchable