Components
Button
Used to initiate an action or trigger the users
Component Status Details
Status component contains a list of checks and completeness that has been tested and owned by each component
Usage
To implement Button, you can use this tag
import { Button } from "@legion-crossplatform/ui";
Buttons are commonly used in user interfaces to initiate an action or prompt the user to open a link. They can contain a combination of clear and concise labels as well as icons to provide additional context. Legion provides a variety of options to customize your buttons to match your desired aesthetic and functionality.
Variants
Legion has various color themes:
- Color Primary Theme.
- Color Secondary Theme.
- Color Tertiary Theme.
- Color Warning Theme.
- Color Success Theme.
- Color Error Theme.
In this page we will demonstrate the usage using the primary variant. Each theme has four variants:
Solid

import { Button } from "@legion-crossplatform/ui";<Button variant="primary">Button</Button>// or you can just use the default variant<Button>Solid primary</Button>
Soft

import { Button } from "@legion-crossplatform/ui";<Button variant="softPrimary">Button</Button>
Outline

import { Button } from "@legion-crossplatform/ui";<Button variant="outlinePrimary">Button</Button>
Transparent
import { Button } from "@legion-crossplatform/ui";<Button variant="transparentPrimary">Button</Button>
Icon
You can set the button to have an icon to the left or right side of the text.
import { Button } from "@legion-crossplatform/ui";import { Activity, Airplay } from '@tamagui/lucide-icons'// Add icon before text<Button icon={Activity} size="$3">IconBefore</Button>//Add icon after text
Attributes
Attribute Name | Type | Description |
---|---|---|
circular | boolean | Makes the button rounded |
icon | JSX.Element | Pass any React element, appears before text |
iconAfter | JSX.Element | Pass any React element, appears after text |
noTextWrap | boolean | If true, button won’t wrap content with a Text element |
scaleIcon | number | Scale the icon more than the default value by this number |
scaleSpace | number | Scale the spacing more than the default value by this number |
spaceFlex | boolean | Makes all space elements have Flex display rule |
size | string | tokens.size | Set a size, number, or one of the size token values |