Feature Pairs
Feature Pairs component
Install
npx ui8kit add feature-pairsPulls in: box, compose, feature-grid, group, inline, kit-box, kit-text, lucide-icon, stack, text, title, utils
Preview
Fast by default
Pages render from static data and ship little script.
Clear structure
One heading per page, landmarks and a skip link come built in.
Safe forms
Inputs carry labels and errors are announced to assistive tools.
Ready for any language
Every text lives in a dictionary, so a new language is one more file.
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 feature-pairs<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards. -->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Feature } from "../blocks/feature-grid.types";
export type FeaturePairsProps = {
features: Feature[];
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import Title from "../compose/Title.svelte";
let { features }: FeaturePairsProps = $props();
</script>
<Box class="grid grid-cols-1 gap-6 sm:grid-cols-2" data-slot="feature-pairs">
{#each features as f, i (f.id)}
{#if (i < 4)}
<Group gap="4" align="start" data-slot="feature-item">
<Inline class="flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground">
<LucideIcon name={f.icon} size={16} />
</Inline>
<Stack gap="2" class="min-w-0">
<Title as={3} size="sm" weight="semibold">
{f.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{f.text}
</Text>
</Stack>
</Group>
{/if}
{/each}
</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 feature-pairs// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards. */
import { Fragment, type ReactNode } from "react";
import { Box, Group, Inline, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import type { Feature } from "../blocks/feature-grid.types";
export type FeaturePairsProps = {
features: Feature[];
};
export function FeaturePairs({ features }: FeaturePairsProps) {
return (
<Box className="grid grid-cols-1 gap-6 sm:grid-cols-2" data-slot="feature-pairs">
{(features ?? []).map((f, i) => (
<Fragment key={f.id}>
{(i < 4) ? (
<Group gap="4" align="start" data-slot="feature-item">
<Inline className={"flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground"}>
<LucideIcon name={f.icon} size={16} />
</Inline>
<Stack gap="2" className="min-w-0">
<Title as={3} size="sm" weight="semibold">
{f.title}
</Title>
<Text size="sm" className="text-muted-foreground">
{f.text}
</Text>
</Stack>
</Group>
) : null}
</Fragment>
))}
</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 feature-pairs<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards. -->
<script lang="ts">
import type { Feature } from "../blocks/feature-grid.types";
export type FeaturePairsProps = {
features: Feature[];
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Title from "../compose/Title.vue";
const { features } = defineProps<FeaturePairsProps>();
</script>
<template>
<Box class="grid grid-cols-1 gap-6 sm:grid-cols-2" data-slot="feature-pairs">
<template v-for="(f, i) in features" :key="f.id">
<Group v-if="(i < 4)" gap="4" align="start" data-slot="feature-item">
<Inline class="flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground">
<LucideIcon :name="f.icon" :size="16" />
</Inline>
<Stack gap="2" class="min-w-0">
<Title :as="3" size="sm" weight="semibold">
{{ f.title }}
</Title>
<Text size="sm" class="text-muted-foreground">
{{ f.text }}
</Text>
</Stack>
</Group>
</template>
</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 feature-pairs// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards. */
import { For, type JSX } from "solid-js";
import { Box, Group, Inline, Stack, Text, Title } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import type { Feature } from "../blocks/feature-grid.types";
export type FeaturePairsProps = {
features: Feature[];
};
export function FeaturePairs({ features }: FeaturePairsProps) {
return (
<Box class="grid grid-cols-1 gap-6 sm:grid-cols-2" data-slot="feature-pairs">
<For each={features ?? []}>{(f, iOf) => { const i = iOf(); return (
<>
{(i < 4) ? (
<Group gap="4" align="start" data-slot="feature-item">
<Inline class="flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground">
<LucideIcon name={f.icon} size={16} />
</Inline>
<Stack gap="2" class="min-w-0">
<Title as={3} size="sm" weight="semibold">
{f.title}
</Title>
<Text size="sm" class="text-muted-foreground">
{f.text}
</Text>
</Stack>
</Group>
) : null}
</>
); }}</For>
</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 feature-pairs// 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/organisms/feature-pairs.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// FeaturePairsProps are the props of FeaturePairs; the values are the JSON shapes of the TypeScript props.
type FeaturePairsProps struct {
Features any `json:"features"`
}
// Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards.
templ FeaturePairs(p FeaturePairsProps) {
{{ vFeatures := p.Features }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 gap-6 sm:grid-cols-2", Attrs: uiutils.Attrs("data-slot", "feature-pairs")}}) {
for vI, vF := range uiutils.L(vFeatures) {
if uiutils.Lt(float64(vI), float64(4)) {
@compose.Group(compose.GroupProps{Gap: "4", Align: "start", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "feature-item")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground"}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vF, "icon")), Size: 16})
}
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "min-w-0"}}) {
@compose.Title(compose.TitleProps{As: "3", Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vF, "title")) }
}
@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vF, "text")) }
}
}
}
}
}
}
}
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 feature-pairs{#- 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/organisms/feature-pairs.json
Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards.
Props (p): features. -#}
{%- set v_features = (p.features ?? null) -%}
{%- set c_6 -%}
{%- for v_f in og_l(v_features) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_5 -%}
{%- set c_1 -%}
{{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_f, ['icon'])), 'size': 16}, with_context = false) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground', 'children': c_1}, with_context = false) }}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ include('compose/Title.html.twig', {'as': 3, 'size': 'sm', 'weight': 'semibold', 'children': c_2}, with_context = false) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_3}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'min-w-0', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '4', 'align': 'start', 'attrs': og_attrs(['data-slot', 'feature-item']), 'children': c_5}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 gap-6 sm:grid-cols-2', 'attrs': og_attrs(['data-slot', 'feature-pairs']), 'children': c_6}, 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 feature-pairs{* 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/organisms/feature-pairs.json
Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards.
Props (p): features. *}
{var $v_features = ($p['features'] ?? null)}
{capture $c_6}
{foreach og_l($v_features) as $v_f}
{var $v_i = $iterator->counter0}
{if og_t(og_lt($v_i, 4))}
{capture $c_5}
{capture $c_1}
{=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_f, ['icon'])), 'size' => 16])|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground', 'children' => (string) $c_1])|noescape}
{capture $c_4}
{capture $c_2}
{=og_text(og_get($v_f, ['title']))}
{/capture}
{=og_include('compose/Title.latte', ['as' => 3, 'size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_2])|noescape}
{capture $c_3}
{=og_text(og_get($v_f, ['text']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_3])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'min-w-0', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'start', 'attrs' => og_attrs(['data-slot', 'feature-item']), 'children' => (string) $c_5])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 gap-6 sm:grid-cols-2', 'attrs' => og_attrs(['data-slot', 'feature-pairs']), 'children' => (string) $c_6])|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 feature-pairs{#- 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/organisms/feature-pairs.json
Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards.
Props (p): features. -#}
{%- set v_features = og_def(p['features'], none) -%}
{%- set c_6 -%}
{%- for v_f in og_l(v_features) %}
{%- set v_i = loop.index0 -%}
{%- if og_t(og_lt(v_i, 4)) %}
{%- set c_5 -%}
{%- set c_1 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_f, ['icon'])), 'Size': 16}}) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex size-8 shrink-0 items-center justify-center rounded bg-primary text-primary-foreground'}, 'children': c_1}) }}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_f, ['title'])) }}
{%- endset -%}
{{ og_include('compose/title.html.j2', {'p': {'As': 3, 'Size': 'sm', 'Weight': 'semibold'}, 'children': c_2}) }}
{%- set c_3 -%}
{{ og_text(og_get(v_f, ['text'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_3}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'min-w-0'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'start', 'Attrs': og_attrs(['data-slot', 'feature-item'])}, 'children': c_5}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 gap-6 sm:grid-cols-2', 'Attrs': og_attrs(['data-slot', 'feature-pairs'])}, 'children': c_6}) }}
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.
Four features of FeatureSplit in two columns: a glyph tile beside the title and text, without cards.
| Prop | Type | Default | Description |
|---|---|---|---|
| features (required) | Feature[] | - |