MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ExampleThemeSwitcher

Function ExampleThemeSwitcher

packages/dev/docs/src/ExampleThemeSwitcher.js:19–42  ·  view source on GitHub ↗
({children})

Source from the content-addressed store, hash-verified

17import React, {useState} from 'react';
18
19export function ExampleThemeSwitcher({children}) {
20 let [colorScheme, setColorScheme] = useState();
21 let [scale, setScale] = useState();
22
23 return (
24 <Example colorScheme={colorScheme}>
25 <Flex direction="column">
26 <Flex marginBottom="size-250" wrap columnGap="size-250" rowGap="size-100">
27 <Picker label="Color Scheme" selectedKey={colorScheme} onSelectionChange={setColorScheme}>
28 <Item key="light">Light</Item>
29 <Item key="dark">Dark</Item>
30 </Picker>
31 <Picker label="Scale" selectedKey={scale} onSelectionChange={setScale}>
32 <Item key="medium">Medium (desktop)</Item>
33 <Item key="large">Large (mobile)</Item>
34 </Picker>
35 </Flex>
36 <Provider scale={scale}>
37 <Flex>{children}</Flex>
38 </Provider>
39 </Flex>
40 </Example>
41 );
42}

Callers

nothing calls this directly

Calls 2

MediumFunction · 0.50
LargeFunction · 0.50

Tested by

no test coverage detected