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

Function ExampleOutput

packages/dev/s2-docs/src/ExampleOutput.tsx:14–68  ·  view source on GitHub ↗
({
  component,
  props = {},
  align = 'center',
  orientation = 'horizontal'
}: ExampleOutputProps)

Source from the content-addressed store, hash-verified

12}
13
14export function ExampleOutput({
15 component,
16 props = {},
17 align = 'center',
18 orientation = 'horizontal'
19}: ExampleOutputProps) {
20 return (
21 <div
22 role="group"
23 aria-label="Rendered component"
24 className={style({
25 display: 'flex',
26 flexDirection: {
27 orientation: {
28 horizontal: 'column',
29 vertical: 'row'
30 }
31 },
32 justifyContent: {
33 align: {
34 center: 'center',
35 start: 'start',
36 end: 'end'
37 }
38 },
39 alignItems: 'center',
40 width: 'full',
41 height: {
42 orientation: {
43 vertical: 80
44 }
45 },
46 overflow: 'auto',
47 gridArea: 'example',
48 borderRadius: 'lg',
49 font: 'ui',
50 padding: {
51 default: 12,
52 lg: 24
53 },
54 boxSizing: 'border-box'
55 })({align, orientation})}
56 style={{
57 background: getBackgroundColor(
58 props.staticColor || (props.isOverBackground ? 'white' : undefined)
59 )
60 }}>
61 <ErrorBoundary>
62 {isValidElement(component)
63 ? cloneElement(component, props)
64 : createElement(component, props)}
65 </ErrorBoundary>
66 </div>
67 );
68}
69
70function getBackgroundColor(staticColor: 'black' | 'white' | undefined) {
71 if (staticColor === 'black') {

Callers

nothing calls this directly

Calls 1

getBackgroundColorFunction · 0.70

Tested by

no test coverage detected