You can use the high-level component ClayButtonWithIcon to create a button with only an icon. If you need an icon and text, you need to compose with ClayIcon
import{Provider}from'@clayui/core';importButton,{ClayButtonWithIcon}from'@clayui/button';importIconfrom'@clayui/icon';importReactfrom'react';import'@clayui/css/lib/css/atlas.css';exportdefaultfunctionApp(){return(<Providerspritemap="/public/icons.svg"><divclassName="p-4"><ClayButtonWithIconaria-label="Close"symbol="times"title="Close"/><Button><spanclassName="inline-item inline-item-before"><Iconsymbol="times"/></span>
Close w/ text
</Button></div></Provider>);}
API Reference
Button
IForwardRef<HTMLButtonElement, IProps>
Parameters
Properties
alert
boolean |undefined
Flag to indicate if button is used within an alert component.
borderless
boolean |undefined
Flag to indicate if the button should be borderless.
block
boolean |undefined
Renders the button as a block element.
dark
boolean |undefined
Flag to indicate if the button should use the clay-dark variant.
displayType
DisplayType |undefined
Determines the button variant to use.
The values beta and beta-dark are deprecated since v3.100.0 - use
translucent and dark instead.
The values null and unstyled are for internal use only.
monospaced
boolean |undefined
Flag to indicate if button should be monospaced.
outline
boolean |undefined
Flag to indicate if the button should use the outline variant.
rounded
boolean |undefined
Flag to indicate if the button should be shaped like a pill.
size
"xs"|"regular"|"sm"|undefined
Determines the size of a button.
small
boolean |undefined
Indicates button should be a small variant.
translucent
boolean |undefined
Flag to indicate if the button should use the translucent variant.
Determines the button variant to use.
The values beta and beta-dark are deprecated since v3.100.0 - use
translucent and dark instead.
The values null and unstyled are for internal use only.
alert
boolean |undefined
Flag to indicate if button is used within an alert component.
block
boolean |undefined
Renders the button as a block element.
borderless
boolean |undefined
Flag to indicate if the button should be borderless.
dark
boolean |undefined
Flag to indicate if the button should use the clay-dark variant.
monospaced
boolean |undefined
Flag to indicate if button should be monospaced.
outline
boolean |undefined
Flag to indicate if the button should use the outline variant.
rounded
boolean |undefined
Flag to indicate if the button should be shaped like a pill.
translucent
boolean |undefined
Flag to indicate if the button should use the translucent variant.