Skip to content
ui8kit

component / components

Icon Tabs

Icon Tabs component

Install

npx ui8kit add icon-tabs

Pulls in: box, compose, kit-box, utils

Preview

No static preview for this item: it needs content or a parent that this page cannot supply. The code is below.

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 icon-tabs
components/icon-tabs.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach
  `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";

  export type IconTabsProps = {
    label?: string;
    class?: string;
    children?: Snippet;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import { cn } from "../utils";

  let { label, class: className, children }: IconTabsProps = $props();
</script>

<Box class={cn("flex items-center gap-2", className)} role="tablist" aria-label={label} data-slot="icon-tabs">
  {@render children?.()}
</Box>

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 icon-tabs
components/icon-tabs.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach
 * `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
 */
import { type ReactNode } from "react";
import { Box } from "../compose";
import { cn } from "../utils";

export type IconTabsProps = {
  label?: string;
  className?: string;
  children?: ReactNode;
};

export function IconTabs({ label, className, children }: IconTabsProps) {
  return (
    <Box
      className={cn("flex items-center gap-2", className)}
      role="tablist"
      aria-label={label}
      data-slot="icon-tabs"
    >
      {children}
    </Box>
  );
}

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 icon-tabs
components/icon-tabs.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
  A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach
  `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
-->
<script lang="ts">
export type IconTabsProps = {
  label?: string;
  class?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import { cn } from "../utils";

const { label, class: className } = defineProps<IconTabsProps>();
defineSlots<{ default?(): unknown }>();
</script>

<template>
  <Box :class="cn('flex items-center gap-2', className)" role="tablist" :aria-label="label" data-slot="icon-tabs">
    <slot />
  </Box>
</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 icon-tabs
components/icon-tabs.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
 * A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach
 * `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
 */
import { type JSX } from "solid-js";
import { Box } from "../compose";
import { cn } from "../utils";

export type IconTabsProps = {
  label?: string;
  class?: string;
  children?: JSX.Element;
};

export function IconTabs({ label, class: className, children }: IconTabsProps) {
  return (
    <Box class={cn("flex items-center gap-2", className)} role="tablist" aria-label={label} data-slot="icon-tabs">
      {children}
    </Box>
  );
}

Solid registry item (JSON)

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

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add icon-tabs
blocks/icon-tabs.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/patterns/icon-tabs.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// IconTabsProps are the props of IconTabs; the values are the JSON shapes of the TypeScript props.
type IconTabsProps struct {
	Label any `json:"label"`
	Class string `json:"className"`
}

// A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
templ IconTabs(p IconTabsProps) {
	{{ vLabel := p.Label }}
	@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex items-center gap-2", p.Class)), Attrs: uiutils.Attrs("role", "tablist", "aria-label", vLabel, "data-slot", "icon-tabs")}}) {
		{ children... }
	}
}

templ registry item (JSON)

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

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add icon-tabs
blocks/icon-tabs.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/patterns/icon-tabs.json
    A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
    Props (p): label, className; children: markup. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set c_1 -%}
  {{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['flex items-center gap-2', (p.className ?? '')])), 'attrs': og_attrs(['role', 'tablist', 'aria-label', v_label, 'data-slot', 'icon-tabs']), 'children': c_1}, with_context = false) }}

Twig registry item (JSON)

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

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add icon-tabs
blocks/icon-tabs.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/patterns/icon-tabs.json
    A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
    Props (p): label, className; children: markup. *}
{var $v_label = ($p['label'] ?? null)}
{capture $c_1}
  {=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['flex items-center gap-2', ($p['className'] ?? '')])), 'attrs' => og_attrs(['role', 'tablist', 'aria-label', $v_label, 'data-slot', 'icon-tabs']), 'children' => (string) $c_1])|noescape}

Latte registry item (JSON)

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

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add icon-tabs
blocks/icon-tabs.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/patterns/icon-tabs.json
    A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).
    Props (p): label, className; children: markup. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set c_1 -%}
  {{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['flex items-center gap-2', og_def(p['className'], '')])), 'Attrs': og_attrs(['role', 'tablist', 'aria-label', v_label, 'data-slot', 'icon-tabs'])}, 'children': c_1}) }}

Jinja2 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.

A row of icon-only tabs (a file tree pane: Files, Search, Apps). Put IconTab in it. Arrow keys: attach `moveFocus` from the utils to the keydown of the row (orientation horizontal, activate).

Props of IconTabs
PropTypeDefault Description
label string-accessible name of the tab list