Buttons initiate app-specific actions, have customizable backgrounds, and can include a title, icon or both. Buttons can be styled with several attributes to look a specific way.



    text: "Button"


Name Type Default Value Required Description
text String? nil NO Label text for button
action (() -> Void)? nil NO Action func for button
leftIcon String? nil NO Left Icon name from Assets
rightIcon String? nil NO Right Icon name from Assets
size XelaButtonSize .Medium NO Size for button (.Large, .Medium, .Small)
state XelaButtonState .Default NO State for button (.Default, .Hover, .Focus, .Disabled)
type XelaButtonType .Primary NO Button type (.Primary, .Secondary)
background Color Color(xelaColor: .Blue) NO Background color for button
foregroundColor Color Color(.white) NO Foreground color for icons and text in button
defaultBorderColor Color Color(xelaColor: .Gray11) NO Default color for border in .Secondary type button
width CGFloat? nil NO Button width
height CGFloat? nil NO Button height
autoResize Bool true NO Button autoresize, if false button width equals button container width, else width equals button content width
borderLineWidth CGFloat 1 NO Border Line width
removePaddings Bool false NO Remove insets paddings from button
systemIcon String? nil NO System Icon name from SF Symbols
iconsRenderingMode Image.TemplateRenderingMode .template NO Icons rendering mode
alignment Alignment .center NO Alignment for content of button (.leading, .center, .trailing)