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

Function Tag

starters/tailwind/src/TagGroup.tsx:106–128  ·  view source on GitHub ↗
({children, color, ...props}: TagProps)

Source from the content-addressed store, hash-verified

104});
105
106export function Tag({children, color, ...props}: TagProps) {
107 let textValue = typeof children === 'string' ? children : undefined;
108 let groupColor = useContext(ColorContext);
109 return (
110 <AriaTag
111 textValue={textValue}
112 {...props}
113 className={composeRenderProps(props.className, (className, renderProps) =>
114 tagStyles({...renderProps, className, color: color || groupColor})
115 )}>
116 {composeRenderProps(children, (children, {allowsRemoving}) => (
117 <>
118 {children}
119 {allowsRemoving && (
120 <Button slot="remove" className={removeButtonStyles}>
121 <XIcon aria-hidden className="w-3 h-3" />
122 </Button>
123 )}
124 </>
125 ))}
126 </AriaTag>
127 );
128}

Callers

nothing calls this directly

Calls 1

composeRenderPropsFunction · 0.85

Tested by

no test coverage detected