Skip to content

IconButton

IconButton is a class inherited from BaseButton, compared to its ancestor, IconButton provides basic infographic support on top of a button.

Usage

IconButton can be created by calling Lydie.Components.Controls.IconButton:

local iconState = Fusion.Value(Icons.album)

Lydie.Components.Controls.IconButton {
    Size = UDim2.fromOffset(200, 40),
    Icon = iconState, 

    OnClickDown = function(),
        iconState:set(Icons.archive)
    end,

    OnClick = function() 
        iconState:set(Icons.album)
    end,
}

Properties

Note

While being inherited from BaseButton, TextButton does not allow using the Fusion.Children to insert children as it will be used to insert the icon instead.

Name Description Required Default
BackgroundColor Background color of the button ❌ Scheme.GetAnimated(Scheme.Color.Text.Primary)
BackgroundOpacity Background opacity of the button ❌ 0.85
ForegroundColor Foreground color of the button, used to color the icon ❌ BackgroundColor or Scheme.GetAnimated(Scheme.Color.Text.Primary)
Icon The asset URL/ID of the icon. ✅ nil
RoundedValue The radius of the 4 corners ❌ Constants.RoundedValues[8]
LayoutOrder The layout order of the button, used in a UIListLayout/UIGridLayout ❌ 0
ZIndex The Z index of the button, used to show hierarchy of the button. ✅ NaN
AnchorPoint The location of the anchor point, defined in Vector2 ❌ Vector2.new(0, 0)
Position The relative position of the button ❌ UDim2.fromScale(0, 0)
Size The size of the button ❌ UDim2.fromOffset(200, 50)

Functions

Name Description Required
OnClickDown: () -> () A function invoked when MouseButton1Down is fired, where a user clicks the button and does not release ❌
OnClick: () -> () A function invoked when InputEnded is fired with matching input types Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch, where a user clicks the button and releases ❌