Components
Button
Used to initiate an action or trigger the users
Status component contains a list of checks and completeness that has been tested and owned by each component
Usage
Buttons are used to initiate an action or trigger the user to open a link.
Use Legion Button styles for actions in forms, dialogs, and more with support lots type and attribute for costumize.
Usage Default LegionUI
LGNSoftBtnLGNSolidBtnLGNOutlineBtnLGNTransparentBtn
Usage Theme
ThemeLGN, ThemeAGR, ThemeMyTEnS, ThemeIHS & ThemeEazy
LGNSoftButtonLGNSolidButtonLGNOutlineButtonLGNTransparentButton
Variant
This code sample demonstrates how to modify the variant of the button :
LGNSoftBtn(title: "Soft Button")LGNSolidBtn(title: "Solid Button")LGNOutlineBtn(title: "Outline Button")LGNTransparentBtn(title: "Transparent Button")
LGNSoftButton(title: "Soft Button")LGNSolidButton(title: "Solid Button")LGNOutlineButton(title: "Outline Button")LGNTransparentButton(title: "Transparent Button")
Attribute
Legion Have 5 Attributes for Customize Button :
Size
This size text button attribute for user to choose size text inside the button.
This code sample demonstrates how to modify size text of the button :
NormalLGNSoftBtn(title: "Soft Button").variant(size: .small)LGNSolidBtn(title: "Solid Button").variant(size: .small)LGNOutlineBtn(title: "Outline Button").variant(size: .small)LGNTransparentBtn(title: "Transparent Button").variant(size: .small)
LGNSoftBtn(title: "Soft Button").variant(size: .normal)LGNSolidBtn(title: "Solid Button").variant(size: .normal)LGNOutlineBtn(title: "Outline Button").variant(size: .normal)LGNTransparentBtn(title: "Transparent Button").variant(size: .normal)
NormalLGNSoftButton(title: "Soft Button").variant(size: .small)LGNSolidButton(title: "Solid Button").variant(size: .small)LGNOutlineButton(title: "Outline Button").variant(size: .small)LGNTransparentButton(title: "Transparent Button").variant(size: .small)
LGNSoftButton(title: "Soft Button").variant(size: .normal)LGNSolidButton(title: "Solid Button").variant(size: .normal)LGNOutlineButton(title: "Outline Button").variant(size: .normal)LGNTransparentButton(title: "Transparent Button").variant(size: .normal)
Responsive
This responsive button or boolean attribute for user to choose the button responsively to the screen / layout or not.
No ResponsiveLGNSoftBtn(title: "Soft Button").variant(size: .small,responsive: true)LGNSolidBtn(title: "Solid Button").variant(size: .small,responsive: true)LGNOutlineBtn(title: "Outline Button").variant(size: .small,responsive: true)LGNTransparentBtn(title: "Transparent Button").variant(size: .small,responsive: true)LGNSoftBtn(title: "Soft Button").variant(size: .normal,responsive: true)LGNSolidBtn(title: "Solid Button").variant(size: .normal,responsive: true)LGNOutlineBtn(title: "Outline Button").variant(size: .normal,responsive: true)LGNTransparentBtn(title: "Transparent Button").variant(size: .normal,responsive: true)
LGNSoftBtn(title: "Soft Button").variant(size: .small,responsive: false)LGNSolidBtn(title: "Solid Button").variant(size: .small,responsive: false)LGNOutlineBtn(title: "Outline Button").variant(size: .small,responsive: false)LGNTransparentBtn(title: "Transparent Button").variant(size: .small,responsive: false)LGNSoftBtn(title: "Soft Button").variant(size: .normal,responsive: false)LGNSolidBtn(title: "Solid Button").variant(size: .normal,responsive: false)LGNOutlineBtn(title: "Outline Button").variant(size: .normal,responsive: false)LGNTransparentBtn(title: "Transparent Button").variant(size: .normal,responsive: false)
No ResponsiveLGNSoftButton(title: "Soft Button").variant(size: .small,responsive: true)LGNSolidButton(title: "Solid Button").variant(size: .small,responsive: true)LGNOutlineButton(title: "Outline Button").variant(size: .small,responsive: true)LGNTransparentButton(title: "Transparent Button").variant(size: .small,responsive: true)LGNSoftButton(title: "Soft Button").variant(size: .normal,responsive: true)LGNSolidButton(title: "Solid Button").variant(size: .normal,responsive: true)LGNOutlineButton(title: "Outline Button").variant(size: .normal,responsive: true)LGNTransparentButton(title: "Transparent Button").variant(size: .normal,responsive: true)
LGNSoftButton(title: "Soft Button").variant(size: .small,responsive: false)LGNSolidButton(title: "Solid Button").variant(size: .small,responsive: false)LGNOutlineButton(title: "Outline Button").variant(size: .small,responsive: false)LGNTransparentButton(title: "Transparent Button").variant(size: .small,responsive: false)LGNSoftButton(title: "Soft Button").variant(size: .normal,responsive: false)LGNSolidButton(title: "Solid Button").variant(size: .normal,responsive: false)LGNOutlineButton(title: "Outline Button").variant(size: .normal,responsive: false)LGNTransparentButton(title: "Transparent Button").variant(size: .normal,responsive: false)
Icon
This icon attribute for user to choose the icon position inside the button.
This code sample demonstrates how to modify icon of the button :
Right IconLGNSoftBtn(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNSolidBtn(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNOutlineBtn(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNTransparentBtn(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))
Left IconLGNSoftBtn(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNSolidBtn(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNOutlineBtn(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNTransparentBtn(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))
LGNSoftBtn(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNSolidBtn(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNOutlineBtn(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNTransparentBtn(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))
Right IconLGNSoftButton(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNSolidButton(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNOutlineButton(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))LGNTransparentButton(title: "Download",centerImage: Image(systemName: "square.and.arrow.down"))
Left IconLGNSoftButton(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNSolidButton(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNOutlineButton(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))LGNTransparentButton(title: "Download",rightImage: Image(systemName: "square.and.arrow.down"))
LGNSoftButton(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNSolidButton(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNOutlineButton(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))LGNTransparentButton(title: "Download",LeftImage: Image(systemName: "square.and.arrow.down"))
Show Activity
This code sample demonstrates how to modify show activity of the button :
LGNSoftBtn(title: "Title").showProgressView(true)LGNSolidBtn(title: "Title").showProgressView(true)LGNOutlineBtn(title: "Title").showProgressView(true)LGNTransparentBtn(title: "Title").showProgressView(true)
LGNSoftButton(title: "Title").showProgressView(true)LGNSolidButton(title: "Title").showProgressView(true)LGNOutlineButton(title: "Title").showProgressView(true)LGNTransparentButton(title: "Title").showProgressView(true)
Disable
This code sample demonstrates how to modify disable of the button :
LGNSoftBtn(title: "Title").disableInteraction(true)LGNSolidBtn(title: "Title").disableInteraction(true)LGNOutlineBtn(title: "Title").disableInteraction(true)LGNTransparentBtn(title: "Title").disableInteraction(true)
LGNSoftButton(title: "Title").disableInteraction(true)LGNSolidButton(title: "Title").disableInteraction(true)LGNOutlineButton(title: "Title").disableInteraction(true)LGNTransparentButton(title: "Title").disableInteraction(true)
Properties
Properties | Description | Default Value |
---|---|---|
action | The action to perform when the user triggers the button. | {} |
title | The title for the button’s title, that describes the purpose of the button’s action . | - |
textFont | To change the font on the title button. | Font.system(size: 16, weight: .bold, design: .default) |
tintBtnColor | To change the tint color of button. | Color.white |
defaultBtnColor | To change the tint color of button. | Color.primary500 |
focusBtnColor | To change the background color of the button when the button is in focus state. | Color.primary700 |