Spinner
The <Spinner/>
component visually indicate that a process is underway and awaiting a change or outcome.
- Usage
- Props
Import
import { Spinner } from "matro-ui";
Spinner
: Spinner component by itself.
Usage
Loading...
Live Editor
<Spinner />
Spinner Size
To change the size of <Spinner/>
, simply set the size
prop (val."XS" | "S" | "M" | "L" | "XL"):
Loading...
Live Editor
<Spinner size="XL" />
Color Scheme
To change the color of <Spinner/>
, set the colorScheme
prop (val. "red" | "orange" | "yellow" | "green" | "cyangreen" | "cyanblue" | "blue" | "purple" | "pink"):
Loading...
Live Editor
<Stack> <Spinner size="M" colorScheme="pink" /> <Spinner size="M" colorScheme="orange" /> <Spinner size="M" colorScheme="cyanblue" /> </Stack>
Conditional Rendering
If you need to hide the <Spinner/>
, you can set the hidden
prop to true, or use a ternary JSX statement:
Loading...
Live Editor
function demo() { const [visible, setVisible] = React.useState(true); return ( <Stack column> <LabelText>Example of hiding with propㅤ<I>"hidden"</I></LabelText> <Spinner hidden={!visible} /> <LabelText>Example of conditional rendering</LabelText> {visible ? <Spinner /> : ""} <Button onClick={() => setVisible(!visible)} rightIcon="⚙️"> toggle visibility </Button> </Stack> ); }
Props of <Spinner/>
:
<Spinner/>
:size
Descriptionsize of the
<Spinner/>
.Type"XS" | "S" | "M" | "L" | "XL"
Default"S"
colorScheme
DescriptionShows last divider if set to true.
Type"red" | "orange" | "yellow" | "green" | "cyangreen" | "cyanblue" | "blue" | "purple" | "pink"
hidden
DescriptionHidden if set to true.
Typeboolean