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

Function Example

packages/react-aria/stories/focus/FocusScope.stories.tsx:104–121  ·  view source on GitHub ↗
({isPortaled, contain}: FocusScopeProps & StoryProps)

Source from the content-addressed store, hash-verified

102}
103
104export let Example = ({isPortaled, contain}: FocusScopeProps & StoryProps): JSX.Element => {
105 let [open, setOpen] = useState(false);
106
107 return (
108 <div>
109 <input aria-label="input before" />
110 <button type="button" onClick={() => setOpen(true)}>
111 Open dialog
112 </button>
113 <input aria-label="input after" />
114 {open && (
115 <NestedDialog onClose={() => setOpen(false)} isPortaled={isPortaled} contain={contain} />
116 )}
117
118 <div id={dialogsRoot} />
119 </div>
120 );
121};
122
123export let ExampleStory: FocusScopeStory = args => <Example {...args} />;
124ExampleStory.storyName = 'Example';

Callers

nothing calls this directly

Calls 1

setOpenFunction · 0.50

Tested by

no test coverage detected