ui/ Button
Unstyled button components and behaviors to be customized by a theme or application.
import Button from '@enact/ui/Button';Members
ButtonComponent
A minimally-styled button component with touch support.
import Button from '@enact/ui/Button';ButtonBaseComponent
A basic button component structure without any behaviors applied to it.
import {ButtonBase} from '@enact/ui/Button';Properties
Called with a reference to the root component.
When using ui/Button.Button, the
refprop is forwarded to this component ascomponentRef.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:
button- The root component classbg- The background node of the buttonclient- The content node of the buttonhasIcon- Applied when there is aniconpresenticon- The icon node, wheniconis setlarge- Applied whensizeprop is'large'minWidth- Applied whenminWidthprop istruepressed- Applied whenpressedprop istrueselected- Applied whenselectedprop istruesmall- Applied whensizeprop is'small'
Applies the
disabledclass.When
true, the button is shown as disabled.Default: falseThe icon displayed within the Button.
The icon will be displayed before the natural reading order of the text, regardless of locale. Any string that is valid for its ui/Button.Button.iconComponent is valid here. If
iconis specified as a string andiconButtonis undefined, the icon is not rendered.This also supports a custom icon, in the form of a DOM node or a Component, with the caveat that if you supply a custom icon, you are responsible for sizing and locale positioning of the custom component.
Setting this to
truemeans theiconComponentwill be rendered but with empty content. This may be useful if you've customized theiconComponentto render the icon content externally.The component used to render the icon.
This component will receive the
iconclass to customize its styling. If icon is not assigned or is false, this component will not be rendered.If this is a component rather than an HTML element string, this component will also receive the
sizeandiconFlip(asflip) properties and should be configured to handle it.Flips the icon.
See: ui/Icon.Icon#flipEnforces a minimum width for the component.
Applies the
minWidthCSS class which can be customized by theming.Default: trueIndicates the component is depressed.
Applies the
pressedCSS class which can be customized by theming.Default: falseIndicates the component is selected.
Applies the
selectedCSS class which can be customized by theming.Default: falseThe size of the button.
Applies the CSS class which can be customized by theming.
ButtonDecoratorHigher-Order Component
A higher-order component that adds touch support to a ButtonBase.
import {ButtonDecorator} from '@enact/ui/Button';