MCPcopy Create free account
hub / github.com/triggerdotdev/trigger.dev / SelectItem

Function SelectItem

apps/webapp/app/components/primitives/Select.tsx:415–460  ·  view source on GitHub ↗
({
  icon,
  checkIcon = <Ariakit.SelectItemCheck className="size-8 flex-none text-white" />,
  shortcut,
  ...props
}: SelectItemProps)

Source from the content-addressed store, hash-verified

413 "group cursor-pointer px-1 pt-1 text-xs text-text-dimmed outline-none last:pb-1";
414
415export function SelectItem({
416 icon,
417 checkIcon = <Ariakit.SelectItemCheck className="size-8 flex-none text-white" />,
418 shortcut,
419 ...props
420}: SelectItemProps) {
421 const combobox = Ariakit.useComboboxContext();
422 const render = combobox ? <Ariakit.ComboboxItem render={props.render} /> : undefined;
423 const ref = React.useRef<HTMLDivElement>(null);
424
425 useShortcutKeys({
426 shortcut: shortcut,
427 action: (e) => {
428 e.preventDefault();
429 e.stopPropagation();
430 if (ref.current) {
431 ref.current.click();
432 }
433 },
434 disabled: props.disabled,
435 enabledOnInputElements: true,
436 });
437
438 return (
439 <Ariakit.SelectItem
440 {...props}
441 render={render}
442 blurOnHoverEnd={false}
443 className={cn(
444 selectItemClasses,
445 "[--padding-block:0.5rem] sm:[--padding-block:0.25rem]",
446 props.className
447 )}
448 ref={ref}
449 >
450 <div className="flex h-7 w-full items-center gap-1 rounded-sm px-2 group-data-[active-item=true]:bg-tertiary">
451 {icon}
452 <div className="grow truncate">{props.children || props.value}</div>
453 {checkIcon}
454 {shortcut && (
455 <ShortcutKey className={cn("size-4 flex-none")} shortcut={shortcut} variant={"small"} />
456 )}
457 </div>
458 </Ariakit.SelectItem>
459 );
460}
461
462export interface SelectLinkItemProps extends Ariakit.SelectItemProps {
463 icon?: React.ReactNode;

Callers

nothing calls this directly

Calls 2

useShortcutKeysFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…