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

Function TreeItem

starters/tailwind/src/Tree.tsx:70–94  ·  view source on GitHub ↗
(props: TreeItemProps)

Source from the content-addressed store, hash-verified

68}
69
70export function TreeItem(props: TreeItemProps) {
71 return (
72 <AriaTreeItem className={itemStyles} textValue={props.title} {...props}>
73 <AriaTreeItemContent {...props}>
74 {({selectionMode, selectionBehavior, hasChildItems, isExpanded, isDisabled}) => (
75 <div className={`flex items-center`}>
76 {selectionMode !== 'none' && selectionBehavior === 'toggle' && (
77 <Checkbox slot="selection" />
78 )}
79 <div className="shrink-0 w-[calc(calc(var(--tree-item-level)_-_1)_*_calc(var(--spacing)_*_3))]" />
80 {hasChildItems ? (
81 <Button slot="chevron" className={expandButton({isDisabled})}>
82 <ChevronRight aria-hidden className={chevron({isExpanded, isDisabled})} />
83 </Button>
84 ) : (
85 <div className="shrink-0 w-8 h-8" />
86 )}
87 {props.title}
88 </div>
89 )}
90 </AriaTreeItemContent>
91 {props.children}
92 </AriaTreeItem>
93 );
94}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected