Section Box
Section Box component
Install
npx ui8kit add section-boxPulls in: card, compose, kit-box, utils
Preview
Hi, I design calm software
Nine years of product design for teams that ship every week. I like systems, plain words and short feedback loops.
Design systems
95%
User research
85%
Prototyping
90%
Frontend code
70%
Product writing
80%
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 section-box<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper). -->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type SectionBoxProps = {
boxed?: boolean;
children?: Snippet;
};
</script>
<script lang="ts">
import Card from "../compose/Card.svelte";
let { boxed = false, children }: SectionBoxProps = $props();
</script>
{#if boxed}
<Card variant="muted">
{@render children?.()}
</Card>
{:else}
{@render children?.()}
{/if}
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 section-box// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper). */
import { type ReactNode } from "react";
import { Card } from "../compose";
export type SectionBoxProps = {
boxed?: boolean;
children?: ReactNode;
};
export function SectionBox({ boxed = false, children }: SectionBoxProps) {
return (
<>
{boxed ? (
<Card variant="muted">
{children}
</Card>
) : (
<>
{children}
</>
)}
</>
);
}
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 section-box<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper). -->
<script lang="ts">
export type SectionBoxProps = {
boxed?: boolean;
};
</script>
<script setup lang="ts">
import Card from "../compose/Card.vue";
const { boxed = false } = defineProps<SectionBoxProps>();
defineSlots<{ default?(): unknown }>();
</script>
<template>
<Card v-if="boxed" variant="muted">
<slot />
</Card>
<slot v-else />
</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 section-box// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper). */
import { type JSX } from "solid-js";
import { Card } from "../compose";
export type SectionBoxProps = {
boxed?: boolean;
children?: JSX.Element;
};
export function SectionBox({ boxed = false, children }: SectionBoxProps) {
return (
<>
{boxed ? (
<Card variant="muted">
{children}
</Card>
) : (
<>
{children}
</>
)}
</>
);
}
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 section-box// 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/section-box.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"
)
// SectionBoxProps are the props of SectionBox; the values are the JSON shapes of the TypeScript props.
type SectionBoxProps struct {
Boxed any `json:"boxed"`
}
// The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper).
templ SectionBox(p SectionBoxProps) {
{{ vBoxed := uiutils.Def(p.Boxed, false) }}
if uiutils.T(vBoxed) {
@compose.Card(compose.CardProps{Variant: "muted", BoxProps: box.BoxProps{}}) {
{ children... }
}
} else {
{ 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 section-box{#- 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/section-box.json
The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper).
Props (p): boxed; children: markup. -#}
{%- set v_boxed = (p.boxed ?? false) -%}
{%- if og_t(v_boxed) %}
{%- set c_1 -%}
{{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Card.html.twig', {'variant': 'muted', 'children': c_1}, with_context = false) }}
{%- else %}
{{ og_slot((children ?? null))|raw }}
{%- endif %}
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 section-box{* 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/section-box.json
The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper).
Props (p): boxed; children: markup. *}
{var $v_boxed = ($p['boxed'] ?? false)}
{if og_t($v_boxed)}
{capture $c_1}
{=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Card.latte', ['variant' => 'muted', 'children' => (string) $c_1])|noescape}
{else}
{=og_slot(($children ?? null))|noescape}
{/if}
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 section-box{#- 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/section-box.json
The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper).
Props (p): boxed; children: markup. -#}
{%- set v_boxed = og_def(p['boxed'], false) -%}
{%- if og_t(v_boxed) %}
{%- set c_1 -%}
{{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/card.html.j2', {'p': {'Variant': 'muted'}, 'children': c_1}) }}
{%- else %}
{{ og_slot(og_def(children, none))|safe }}
{%- endif %}
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.
The body of a SectionFrame: inside a card when `boxed`, else the children as they are (no wrapper).
| Prop | Type | Default | Description |
|---|---|---|---|
| boxed | boolean | false | the children sit in a card |