class ButtonBuilder
A builder class for creating UIButton instances.
class ButtonBuilder extends UIElement.ElementBuilder<UIButton>;
Notes
- Returned by the UI.Button() function.
Instance members
initializer readonly
The initializer used to create each button instance.text()
Sets the button text.fmt()
Sets localizable or dynamic text for the button.icon()
Sets the button icon.chevron()
Adds a chevron icon to the button.buttonVariant()
Enables (or disables) the specified button style variant.accent()
Enables the accent button style variant (for a primary/accent-colored button).link()
Enables the link button style variant (link color, underlined).small()
Enables the small button style variant (reduced font size and padding).ghost()
Enables the ghost button style variant (transparent background, subtle hover).bare()
Enables the bare button style variant (no background, border, or interaction highlight).disabled()
Disables the button.pressed()
Sets the visual pressed state of the button.value()
Associates an arbitrary value with the button.formStateValue()
Adds a two-way binding to a form state field.navigateTo()
Sets a navigation target, making the button behave like a link.dropdownMenu()
Adds a modal menu that shows when the button is clicked.dropdownPicker()
Adds a modal menu for selecting a value from a list of options.onMenuItemSelect()
Handles theMenuItemSelectevent emitted when a menu item is selected.disableKeyboardFocus()
Disables keyboard focus for the button.
Inherited members
build()
Creates a new instance of the UI element.apply()
Applies a view builder function, returning its result.extend()
Extends this builder with custom methods, returning a new builder object.name()
Sets the element name, which can be used to identify the element in the view hierarchy.accessibleRole()
Sets the WAI-ARIA role for accessibility.accessibleLabel()
Sets the WAI-ARIA label for accessibility.hideWhen()
Hides the element when a specified condition is true.hideUnless()
Hides the element unless a specified condition is true.position()
Sets the position of the element within its parent.size()
Sets both the width and height of the element.width()
Sets the outer, minimum, and/or maximum width of the element.minWidth()
Sets the minimum width of the element.maxWidth()
Sets the maximum width of the element.height()
Sets the outer, minimum, and/or maximum height of the element.minHeight()
Sets the minimum height of the element.maxHeight()
Sets the maximum height of the element.flex()
Enables flex-grow on the element, allowing it to take up as much space as possible (or flex-shrink to allow it to shrink).padding()
Sets the padding around the element.margin()
Sets the margin around the element.textColor()
Sets the text color.fg()
Alias for textColor; sets the text color.background()
Sets the background color or gradient.bg()
Alias for background; sets the background color or gradient.border()
Sets the border properties of the element.borderRadius()
Sets the radius of the border corners.dropShadow()
Adds a drop shadow effect.opacity()
Sets the opacity of the element.dim()
Dims the element by reducing its opacity.cursor()
Sets the mouse cursor style when hovering over the element.fontFamily()
Sets the font family.fontSize()
Sets the font size.fontWeight()
Sets the font weight.bold()
Makes the text bold.italic()
Makes the text italic.underline()
Adds an underline to the text.lineHeight()
Sets the line height.textAlign()
Sets the text alignment.style()
Applies a set of style overrides.effect()
Applies a render effect to this element.requestFocus()
Requests input focus for this element after it has been rendered.on()
Adds an event handler to all instances of the UI element.onKey()
Adds an event handler forKeyDownevents with the specified key name.onClick()
Handles theClickevent.onDoubleClick()
Handles theDoubleClickevent.onContextMenu()
Handles theContextMenuevent.onPress()
Handles thePressevent.onRelease()
Handles theReleaseevent.onKeyDown()
Handles theKeyDownevent.onKeyUp()
Handles theKeyUpevent.onFocusIn()
Handles theFocusInevent.onFocusOut()
Handles theFocusOutevent.onChange()
Handles theChangeevent.onInput()
Handles theInputevent.onBeforeRender()
Handles theBeforeRenderevent, emitted before the element is rendered for the first time.onRendered()
Handles theRenderedevent, emitted when the element has been rendered.
Related
class UIButton
A view class that represents a button control.
