Skip to content
ui8kit

component / components

Figure Block

Figure Block component

Install

npx ui8kit add figure-block

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

Preview

Harbor at dawn

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 figure-block
components/figure-block.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. -->
<!--
  Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag
  figure.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";

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

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

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

<Block tag="figure" class={cn(className)} data-slot={(testid ?? "figure-block")}>
  {@render children?.()}
</Block>

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 figure-block
components/figure-block.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.
/**
 * Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag
 * figure.
 */
import { type ReactNode } from "react";
import { Block } from "../compose";
import { cn } from "../utils";

export type FigureBlockProps = {
  testid?: string;
  className?: string;
  children?: ReactNode;
};

export function FigureBlock({ testid, className, children }: FigureBlockProps) {
  return (
    <Block tag="figure" className={cn(className)} data-slot={(testid ?? "figure-block")}>
      {children}
    </Block>
  );
}

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 figure-block
components/figure-block.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. -->
<!--
  Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag
  figure.
-->
<script lang="ts">
export type FigureBlockProps = {
  testid?: string;
  class?: string;
};
</script>

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

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

<template>
  <Block tag="figure" :class="cn(className)" :data-slot="(testid ?? 'figure-block')">
    <slot />
  </Block>
</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 figure-block
components/figure-block.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.
/**
 * Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag
 * figure.
 */
import { type JSX } from "solid-js";
import { Block } from "../compose";
import { cn } from "../utils";

export type FigureBlockProps = {
  testid?: string;
  class?: string;
  children?: JSX.Element;
};

export function FigureBlock({ testid, class: className, children }: FigureBlockProps) {
  return (
    <Block tag="figure" class={cn(className)} data-slot={(testid ?? "figure-block")}>
      {children}
    </Block>
  );
}

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 figure-block
blocks/figure-block.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/organisms/figure-block.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"
)

// FigureBlockProps are the props of FigureBlock; the values are the JSON shapes of the TypeScript props.
type FigureBlockProps struct {
	Testid any `json:"testid"`
	Class string `json:"className"`
}

// Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag figure.
templ FigureBlock(p FigureBlockProps) {
	{{ vTestid := p.Testid }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "figure", Class: uiutils.S(uiutils.Cnv(p.Class)), Attrs: uiutils.Attrs("data-slot", uiutils.Coalesce(vTestid, "figure-block"))}}) {
		{ 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 figure-block
blocks/figure-block.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/organisms/figure-block.json
    Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag figure.
    Props (p): testid, className; children: markup. -#}
{%- set v_testid = (p.testid ?? null) -%}
{%- set c_1 -%}
  {{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'figure', 'class': og_s(og_cnv([(p.className ?? '')])), 'attrs': og_attrs(['data-slot', og_coalesce([v_testid, 'figure-block'])]), '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 figure-block
blocks/figure-block.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/organisms/figure-block.json
    Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag figure.
    Props (p): testid, className; children: markup. *}
{var $v_testid = ($p['testid'] ?? null)}
{capture $c_1}
  {=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'figure', 'class' => og_s(og_cnv([($p['className'] ?? '')])), 'attrs' => og_attrs(['data-slot', og_coalesce([$v_testid, 'figure-block'])]), '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 figure-block
blocks/figure-block.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/organisms/figure-block.json
    Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag figure.
    Props (p): testid, className; children: markup. -#}
{%- set v_testid = og_def(p['testid'], none) -%}
{%- set c_1 -%}
  {{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'figure', 'Class': og_s(og_cnv([og_def(p['className'], '')])), 'Attrs': og_attrs(['data-slot', og_coalesce([v_testid, 'figure-block'])])}, '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.

Self-contained content with an optional caption (a quote, a picture, a stat) in its own file: Block tag figure.

Props of FigureBlock
PropTypeDefault Description
testid string-data-slot of the root (default: the component name)

Used in