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

Function ComboBoxItem

packages/@react-spectrum/s2/src/ComboBox.tsx:454–520  ·  view source on GitHub ↗
(props: ComboBoxItemProps)

Source from the content-addressed store, hash-verified

452} as const;
453
454export function ComboBoxItem(props: ComboBoxItemProps): ReactNode {
455 let ref = useRef(null);
456 let isLink = props.href != null;
457 let {size} = useContext(InternalComboboxContext);
458 // oxlint-disable react/react-compiler
459 return (
460 <ListBoxItem
461 {...props}
462 ref={ref}
463 textValue={
464 props.textValue ||
465 (typeof props.children === 'string' ? (props.children as string) : undefined)
466 }
467 style={pressScale(ref, props.UNSAFE_style)}
468 className={renderProps =>
469 (props.UNSAFE_className || '') + listboxItem({...renderProps, size, isLink}, props.styles)
470 }>
471 {renderProps => {
472 let {children} = props;
473 return (
474 <>
475 <Provider
476 values={[
477 [
478 IconContext,
479 {
480 slots: {
481 icon: {
482 render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}),
483 styles: icon
484 }
485 }
486 }
487 ],
488 [
489 AvatarContext,
490 {
491 slots: {
492 avatar: {size: '1lh', styles: avatar}
493 }
494 }
495 ],
496 [
497 TextContext,
498 {
499 slots: {
500 label: {styles: label({size})},
501 description: {styles: description({...renderProps, size})}
502 }
503 }
504 ]
505 ]}>
506 {!isLink && !props.onAction && (
507 <CheckmarkIcon
508 size={checkmarkIconSize[size]}
509 className={checkmark({...renderProps, size})}
510 />
511 )}

Callers

nothing calls this directly

Calls 2

pressScaleFunction · 0.90
centerBaselineFunction · 0.90

Tested by

no test coverage detected