1 | ---
|
2 | title: Spinner
|
3 | storybookPath: feedback-overlays-spinner--default
|
4 | isExperimentalPackage: true
|
5 | ---
|
6 |
|
7 | Spinner indicates to users that their request is in progress. In most cases
|
8 | [you should use the `loading` prop on a Button instead of using this component directly](/package/button#loading).
|
9 |
|
10 | ## Examples
|
11 |
|
12 | ### Tones
|
13 |
|
14 | The appearance of Spinner can be customised with the tone prop.
|
15 |
|
16 | Defaults to `primary`.
|
17 |
|
18 | ```jsx live
|
19 | const tones = ['secondary', 'critical', 'positive', 'neutral'];
|
20 |
|
21 | return (
|
22 | <Stack align="left" gap="large">
|
23 | <Inline gap="large">
|
24 | {tones.map(tone => (
|
25 | <Spinner key={tone} tone={tone} />
|
26 | ))}
|
27 | </Inline>
|
28 | </Stack>
|
29 | );
|
30 | ```
|
31 |
|
32 | ```jsx live
|
33 | const backgrounds = [
|
34 | // Light
|
35 | ['surface', 'positiveLight', 'infoLight', 'cautionLight', 'criticalLight'],
|
36 | // Dark
|
37 | ['muted', 'positive', 'info', 'caution', 'critical'],
|
38 | ];
|
39 |
|
40 | return (
|
41 | <Stack gap="large">
|
42 | {backgrounds.map((backgroundLightness, index) => (
|
43 | <Inline key={index} gap="large">
|
44 | {backgroundLightness.map(background => (
|
45 | <Box
|
46 | key={background}
|
47 | background={background}
|
48 | shadow="medium"
|
49 | height="medium"
|
50 | width="medium"
|
51 | display="flex"
|
52 | flexShrink={0}
|
53 | alignItems="center"
|
54 | justifyContent="center"
|
55 | >
|
56 | <Spinner />
|
57 | </Box>
|
58 | ))}
|
59 | </Inline>
|
60 | ))}
|
61 | </Stack>
|
62 | );
|
63 | ```
|
64 |
|
65 | ## Size
|
66 |
|
67 | Spinners available in two size: `xxsmall` and `xsmall`.
|
68 |
|
69 | Defaults to `xsmall`.
|
70 |
|
71 | ```jsx live
|
72 | <Row gap="large">
|
73 | <Spinner size="xxsmall" />
|
74 | <Spinner size="xsmall" />
|
75 | </Row>
|
76 | ```
|
77 |
|
78 | ## Props
|
79 |
|
80 | ### Spinner
|
81 |
|
82 | <PropsTable displayName="Spinner" />
|
83 |
|
84 | [data-attribute-map]:
|
85 | https://github.com/brighte-labs/spark-web/blob/e7f6f4285b4cfd876312cc89fbdd094039aa239a/packages/utils/src/internal/buildDataAttributes.ts#L1
|