Section Column
Section Column component
Install
npx ui8kit add section-columnPulls in: compose, kit-box, presets, stack, utils
Preview
Before and after
Setup
Weeks of wiring
One command
Pages
Copied by hand
Composed from blocks
Themes
Colors set one by one
Tokens shared by every block
Checks
Review by eye
Automatic on every build
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-column<!-- 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 stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure
(xs to 3xl) holds the column at that width, centred.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import { variants } from "../utils";
/** SectionColumn: the classes of each value (shadcn/cva style). */
export const sectionColumnVariants = variants({
variants: {
measure: {
default: "",
landing: "",
fill: "",
xs: "mx-auto w-full max-w-xs",
sm: "mx-auto w-full max-w-sm",
md: "mx-auto w-full max-w-md",
lg: "mx-auto w-full max-w-lg",
xl: "mx-auto w-full max-w-xl",
"2xl": "mx-auto w-full max-w-2xl",
"3xl": "mx-auto w-full max-w-3xl",
},
},
defaultVariants: { measure: "default" },
});
export type SectionColumnProps = {
measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
children?: Snippet;
};
</script>
<script lang="ts">
import Stack from "../compose/Stack.svelte";
let { measure = "default", children }: SectionColumnProps = $props();
</script>
<Stack gap="6" align="stretch" class={sectionColumnVariants({ measure: measure })} data-slot="section-column">
{@render children?.()}
</Stack>
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-column// 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 stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure
* (xs to 3xl) holds the column at that width, centred.
*/
import { type ReactNode } from "react";
import { Stack } from "../compose";
import { variants } from "../utils";
/** SectionColumn: the classes of each value (shadcn/cva style). */
export const sectionColumnVariants = variants({
variants: {
measure: {
default: "",
landing: "",
fill: "",
xs: "mx-auto w-full max-w-xs",
sm: "mx-auto w-full max-w-sm",
md: "mx-auto w-full max-w-md",
lg: "mx-auto w-full max-w-lg",
xl: "mx-auto w-full max-w-xl",
"2xl": "mx-auto w-full max-w-2xl",
"3xl": "mx-auto w-full max-w-3xl",
},
},
defaultVariants: { measure: "default" },
});
export type SectionColumnProps = {
measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
children?: ReactNode;
};
export function SectionColumn({ measure = "default", children }: SectionColumnProps) {
return (
<Stack
gap="6"
align="stretch"
className={sectionColumnVariants({ measure: measure })}
data-slot="section-column"
>
{children}
</Stack>
);
}
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-column<!-- 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 stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure
(xs to 3xl) holds the column at that width, centred.
-->
<script lang="ts">
import { variants } from "../utils";
/** SectionColumn: the classes of each value (shadcn/cva style). */
export const sectionColumnVariants = variants({
variants: {
measure: {
default: "",
landing: "",
fill: "",
xs: "mx-auto w-full max-w-xs",
sm: "mx-auto w-full max-w-sm",
md: "mx-auto w-full max-w-md",
lg: "mx-auto w-full max-w-lg",
xl: "mx-auto w-full max-w-xl",
"2xl": "mx-auto w-full max-w-2xl",
"3xl": "mx-auto w-full max-w-3xl",
},
},
defaultVariants: { measure: "default" },
});
export type SectionColumnProps = {
measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
};
</script>
<script setup lang="ts">
import Stack from "../compose/Stack.vue";
const { measure = "default" } = defineProps<SectionColumnProps>();
defineSlots<{ default?(): unknown }>();
</script>
<template>
<Stack gap="6" align="stretch" :class="sectionColumnVariants({ measure: measure })" data-slot="section-column">
<slot />
</Stack>
</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-column// 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 stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure
* (xs to 3xl) holds the column at that width, centred.
*/
import { type JSX } from "solid-js";
import { Stack } from "../compose";
import { variants } from "../utils";
/** SectionColumn: the classes of each value (shadcn/cva style). */
export const sectionColumnVariants = variants({
variants: {
measure: {
default: "",
landing: "",
fill: "",
xs: "mx-auto w-full max-w-xs",
sm: "mx-auto w-full max-w-sm",
md: "mx-auto w-full max-w-md",
lg: "mx-auto w-full max-w-lg",
xl: "mx-auto w-full max-w-xl",
"2xl": "mx-auto w-full max-w-2xl",
"3xl": "mx-auto w-full max-w-3xl",
},
},
defaultVariants: { measure: "default" },
});
export type SectionColumnProps = {
measure?: "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
children?: JSX.Element;
};
export function SectionColumn({ measure = "default", children }: SectionColumnProps) {
return (
<Stack gap="6" align="stretch" class={sectionColumnVariants({ measure: measure })} data-slot="section-column">
{children}
</Stack>
);
}
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-column// 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-column.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"
)
// SectionColumnProps are the props of SectionColumn; the values are the JSON shapes of the TypeScript props.
type SectionColumnProps struct {
Measure any `json:"measure"`
}
// The stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure (xs to 3xl) holds the column at that width, centred.
templ SectionColumn(p SectionColumnProps) {
{{ vMeasure := uiutils.Def(p.Measure, "default") }}
@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{Class: uiutils.S(recipeSectionColumn.Of(map[string]any{"measure": vMeasure})), Attrs: uiutils.Attrs("data-slot", "section-column")}}) {
{ 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-column{#- 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-column.json
The stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure (xs to 3xl) holds the column at that width, centred.
Props (p): measure; children: markup. -#}
{%- set v_measure = (p.measure ?? 'default') -%}
{%- set c_1 -%}
{{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'class': og_s(og_recipe('blocks/recipes/section-column.variants.json', {'measure': v_measure})), 'attrs': og_attrs(['data-slot', 'section-column']), '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 section-column{* 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-column.json
The stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure (xs to 3xl) holds the column at that width, centred.
Props (p): measure; children: markup. *}
{var $v_measure = ($p['measure'] ?? 'default')}
{capture $c_1}
{=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'class' => og_s(og_recipe('blocks/recipes/section-column.variants.json', ['measure' => $v_measure])), 'attrs' => og_attrs(['data-slot', 'section-column']), '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 section-column{#- 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-column.json
The stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure (xs to 3xl) holds the column at that width, centred.
Props (p): measure; children: markup. -#}
{%- set v_measure = og_def(p['measure'], 'default') -%}
{%- set c_1 -%}
{{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch', 'Class': og_s(og_recipe('blocks/recipes/section-column.variants.json', {'measure': v_measure})), 'Attrs': og_attrs(['data-slot', 'section-column'])}, '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.
The stacked body of a SectionFrame: the heading, the children and the media in one column; a narrow measure (xs to 3xl) holds the column at that width, centred.
| Prop | Type | Default | Description |
|---|---|---|---|
| measure | "default" | "landing" | "fill" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "default" | the measure of the SectionFrame; xs to 3xl: a centred column of that width |