Icon Tabs
Icon Tabs component
Install
npx ui8kit add icon-tabsPulls 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-cdnnpx ui8kit add icon-tabs<!-- 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>
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-cdnnpx ui8kit add icon-tabs// 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>
);
}
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-cdnnpx ui8kit add icon-tabs<!-- 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>
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-cdnnpx ui8kit add icon-tabs// 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>
);
}
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-cdnnpx ui8kit add icon-tabs// 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... }
}
}
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-cdnnpx ui8kit add icon-tabs{#- 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) }}
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-cdnnpx ui8kit add icon-tabs{* 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}
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-cdnnpx ui8kit add icon-tabs{#- 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}) }}
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).
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | - | accessible name of the tab list |