Skip to main content

ButtonStyle

Customizes the appearance of buttons.

class ButtonStyle

Properties​

image​

image: ImageAsset? = nil

The image used to render the button. Its frames select the visual state (resting, hovered, pressed, disabled).

See ImageAsset


width​

width: Float? = nil

The width of the button. If set to nil the image size is used.


height​

height: Float? = nil

The height of the button. If set to nil the image size is used.


padding​

padding: EdgeInsets = EdgeInsets(0)

The space added around the button's content.

See EdgeInsets


font_family​

font_family: ui.FontFamilyName = default_font

The font family of the button text.


font_weight​

font_weight: Int = ui.font_weights.normal

The font weight of the button text.


italic​

italic: Bool = false

Enables the italic style for the button text.


text_size​

text_size: Int = 12

The size of the button text in pixels.


text_colors​

text_colors: ButtonStateColors = ButtonStateColors(...)

The text color used in each of the button's visual states.

See ButtonStateColors


text_alignment​

text_alignment: ui.Alignment = ui.Alignment.center

The alignment of the text within the button's frame.

Methods​

copy​

copy() -> (ButtonStyle)

Returns a shallow copy (nested reference objects aren't copied).


deep_copy​

deep_copy() -> (ButtonStyle)

Returns a deep copy, including copies of padding and text_colors.


overriding​

overriding(_ modify: (ButtonStyle) -> ()) -> (ButtonStyle)

Returns a modified copy of the style. Modify the copy inside the modify function.