Buttons act as a trigger for certain actions. While this is their main purpose, in some very rare cases, they can be used as links to navigate to other pages.
action: The most distinctive type of Button. It is used for the primary action on a screen that requires the most attention.
We recommend using only one such button per page.
normal: Default type of Button designed for secondary actions or to maintain the importance of an action without drawing too much attention to it.
raised: Placed above the content as a floating element, usually with a fixed location.
outlined: Used for secondary actions that require less attention. It can be used with or without a main button; in the former case, it must be an emphasized one.
outlined-action: Usually used as a link to another page or external resource.
This type also has semantic variations that can be used when additional semantics are needed: outlined-info, outlined-success, outlined-warning, and outlined-danger.
flat: Used for auxiliary actions that require the least attention. It is often used in a list of buttons or action icons (without text) in an editor.
flat-secondary: Less emphasized than the flat button. It is often used as a secondary button in dialog boxes and modal windows.
flat-action: Usually used as a link to another page or external resource.
It also has semantic variations that can be used where additional semantics are needed: outlined-info, outlined-success, outlined-warning, and outlined-danger.
The normal-contrast, outline-contrast, and flat-contrast buttons highlight actions against complex background, e.g., in a banner, or against an inverse background.
Use the width property to manage the way the Button behaves inside the container:
auto: Limits the maximum width of the Button by hiding the overflowing content with an ellipsis.
max: Matches the Button width to the width of the parent container, also hiding the overflowing content with an ellipsis.
Default
Auto
Max
import{Button}from'@gravity-ui/uikit';import{typeCSSProperties}from'react';const containerStyle:CSSProperties={ width:100, border:'2px dashed gray',};const titleStyle:CSSProperties={ textAlign:'center',};exportdefaultfunction(){return(<><divstyle={containerStyle}><h4style={titleStyle}>Default</h4><p><Button>Text</Button></p><p><Button>Very Long Text</Button></p></div><divstyle={containerStyle}><h4style={titleStyle}>Auto</h4><p><Buttonwidth="auto">Text</Button></p><p><Buttonwidth="auto">Very Long Text</Button></p></div><divstyle={containerStyle}><h4style={titleStyle}>Max</h4><p><Buttonwidth="max">Text</Button></p><p><Buttonwidth="max">Very Long Text</Button></p></div></>);}
The pin property allows you to manage the shape of the start and end edges and is usually used for combining multiple buttons in a single unit.
The pin property value consists of the start and end style names separated by a hyphen, e.g., round-brick.
The edge styles are: round (default), circle, brick, and clear.