Skip to content
ui8kit

primitive / primitives

Select Option

Select Option primitive

Install

npx ui8kit add select-option

Pulls in: kit-select, recipes, utils

Preview

default

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add select-option
compose/SelectOption.svelte
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SelectOption: SelectOption. -->
<script lang="ts">
  import type { ComponentProps, Snippet } from "svelte";
  import Prim from "../kit/ui/select/SelectOption.svelte";
  import { cn } from "../kit/utils";
  import { rc } from "./recipes";

  let { class: className, children, ...rest }: ComponentProps<typeof Prim> & { class?: string; children?: Snippet } = $props();
  const cls = $derived(cn(className));
</script>

<Prim class={cls} {...rest}>{@render children?.()}</Prim>

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add select-option
compose/select-option.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import type { ComponentProps } from "react";
import { SelectOption as Prim } from "../kit/ui/select/select";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SelectOptionProps = Omit<ComponentProps<typeof Prim>, "tag"> & { className?: string };

/** SelectOption: SelectOption. */
export function SelectOption({ className, ...rest }: SelectOptionProps) {
  return <Prim className={cn(className)} {...rest} />;
}

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add select-option
compose/SelectOption.vue
<!-- Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT. -->
<!-- SelectOption: SelectOption. -->
<script setup lang="ts">
import { computed, useAttrs } from "vue";
import Prim from "../kit/ui/select/SelectOption.vue";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

defineOptions({ name: "SelectOption", inheritAttrs: false });
const props = defineProps<{  }>();
const attrs = useAttrs();
const rest = computed(() => {
  const { class: _class, ...r } = attrs;
  return r;
});
const cls = computed(() => cn(attrs.class as string | undefined));
const tagValue = computed(() => "");
</script>

<template>
  <Prim :class="cls" v-bind="rest"><slot /></Prim>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add select-option
compose/select-option.solid.tsx
// Code generated by packages/kit-compose/src/build.ts from src/map.ts + variants/. DO NOT EDIT.
import { splitProps, type ComponentProps } from "solid-js";
import { SelectOption as Prim } from "../kit/ui/select/select.solid";
import { cn } from "../kit/utils";
import { rc } from "./recipes";

export type SelectOptionProps = Omit<ComponentProps<typeof Prim>, "tag" | "class" | "className"> & { class?: string; className?: string };

/** SelectOption: SelectOption. */
export function SelectOption(props: SelectOptionProps) {
  const [local, rest] = splitProps(props, ["class", "className"]);
  return <Prim class={cn(local.class ?? local.className)} {...rest} />;
}

Solid registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

SelectOption renders a native option.

Props of SelectOption
PropTypeDefault Description
selected boolean-
disabled boolean-