Skip to content
ui8kit

component / components

Prompt Composer

Prompt Composer component

Install

npx ui8kit add prompt-composer

Pulls in: box, button, compose, group, kit-box, kit-button, kit-text, lucide-icon, presets, text, 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-cdn
npx ui8kit add prompt-composer
components/prompt-composer.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. -->
<!--
  A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send
  button. Static links only; a host adds behavior.
-->
<script lang="ts" module>
  import type { Snippet } from "svelte";

  export type PromptComposerProps = {
    label?: string;
    attachLabel?: string;
    modelLabel?: string;
    send?: string;
    href?: string;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Text from "../compose/Text.svelte";
  import { defaults } from "../presets/defaults";
  import { cn, urlOf } from "../utils";

  let { label, attachLabel, modelLabel, send, href }: PromptComposerProps = $props();
</script>

<Box
  class={cn(
    "mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30",
    defaults.hero.composer
  )}
  data-slot="email-form"
>
  {#if attachLabel}
    <Group gap="2" align="center" data-slot="composer-attachments">
      <Button
        variant="ghost"
        size="sm"
        class={cn(
          "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
          defaults.hero.attach
        )}
      >
        <LucideIcon name="file-text" size={16} />
        {attachLabel}
      </Button>
      <Button
        variant="ghost"
        size="sm"
        class={cn(
          "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
          defaults.hero.attach
        )}
      >
        <LucideIcon name="paperclip" size={16} />
        {attachLabel}
      </Button>
    </Group>
  {/if}
  <Text
    size="xs"
    weight="semibold"
    class={cn("flex w-full items-center leading-5 text-background/80", defaults.hero.promptLine)}
    data-slot="field"
  >
    {label}
  </Text>
  <Group gap="2" align="center" justify="between" class="h-8 w-full" data-slot="composer-tools">
    <Group gap="2" align="center">
      <Button
        variant="ghost"
        size="sm"
        layout="icon"
        class="bg-background/10 text-background hover:bg-background/20"
        aria-label={(attachLabel ?? "Attach")}
      >
        <LucideIcon name="plus" size={16} />
      </Button>
      {#if modelLabel}
        <Button
          variant="ghost"
          size="sm"
          class={cn("gap-2 bg-background/10 text-background hover:bg-background/20", defaults.hero.model)}
        >
          <LucideIcon name="sparkles" size={16} />
          {modelLabel}
          <LucideIcon name="chevron-down" size={16} />
        </Button>
      {/if}
    </Group>
    <Button href={urlOf(href)} variant="secondary" size="sm" layout="icon" aria-label={(send ?? "Send")}>
      <LucideIcon name="arrow-up" size={16} />
    </Button>
  </Group>
</Box>

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 prompt-composer
components/prompt-composer.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.
/**
 * A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send
 * button. Static links only; a host adds behavior.
 */
import { type ReactNode } from "react";
import { Box, Button, Group, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";

export type PromptComposerProps = {
  label?: string;
  attachLabel?: string;
  modelLabel?: string;
  send?: string;
  href?: string;
};

export function PromptComposer({ label, attachLabel, modelLabel, send, href }: PromptComposerProps) {
  return (
    <Box
      className={cn(
        "mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30",
        defaults.hero.composer
      )}
      data-slot="email-form"
    >
      {attachLabel ? (
        <Group gap="2" align="center" data-slot="composer-attachments">
          <Button
            variant="ghost"
            size="sm"
            className={cn(
              "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
              defaults.hero.attach
            )}
          >
            <LucideIcon name="file-text" size={16} />
            {attachLabel}
          </Button>
          <Button
            variant="ghost"
            size="sm"
            className={cn(
              "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
              defaults.hero.attach
            )}
          >
            <LucideIcon name="paperclip" size={16} />
            {attachLabel}
          </Button>
        </Group>
      ) : null}
      <Text
        size="xs"
        weight="semibold"
        className={cn("flex w-full items-center leading-5 text-background/80", defaults.hero.promptLine)}
        data-slot="field"
      >
        {label}
      </Text>
      <Group gap="2" align="center" justify="between" className="h-8 w-full" data-slot="composer-tools">
        <Group gap="2" align="center">
          <Button
            variant="ghost"
            size="sm"
            layout="icon"
            className="bg-background/10 text-background hover:bg-background/20"
            aria-label={(attachLabel ?? "Attach")}
          >
            <LucideIcon name="plus" size={16} />
          </Button>
          {modelLabel ? (
            <Button
              variant="ghost"
              size="sm"
              className={cn("gap-2 bg-background/10 text-background hover:bg-background/20", defaults.hero.model)}
            >
              <LucideIcon name="sparkles" size={16} />
              {modelLabel}
              <LucideIcon name="chevron-down" size={16} />
            </Button>
          ) : null}
        </Group>
        <Button href={urlOf(href)} variant="secondary" size="sm" layout="icon" aria-label={(send ?? "Send")}>
          <LucideIcon name="arrow-up" size={16} />
        </Button>
      </Group>
    </Box>
  );
}

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 prompt-composer
components/prompt-composer.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. -->
<!--
  A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send
  button. Static links only; a host adds behavior.
-->
<script lang="ts">
export type PromptComposerProps = {
  label?: string;
  attachLabel?: string;
  modelLabel?: string;
  send?: string;
  href?: string;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Button from "../compose/Button.vue";
import Group from "../compose/Group.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";

const { label, attachLabel, modelLabel, send, href } = defineProps<PromptComposerProps>();
</script>

<template>
  <Box
    :class="cn(
      'mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30',
      defaults.hero.composer
    )"
    data-slot="email-form"
  >
    <Group v-if="attachLabel" gap="2" align="center" data-slot="composer-attachments">
      <Button
        variant="ghost"
        size="sm"
        :class="cn(
          'gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20',
          defaults.hero.attach
        )"
      >
        <LucideIcon name="file-text" :size="16" />
        {{ attachLabel }}
      </Button>
      <Button
        variant="ghost"
        size="sm"
        :class="cn(
          'gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20',
          defaults.hero.attach
        )"
      >
        <LucideIcon name="paperclip" :size="16" />
        {{ attachLabel }}
      </Button>
    </Group>
    <Text
      size="xs"
      weight="semibold"
      :class="cn('flex w-full items-center leading-5 text-background/80', defaults.hero.promptLine)"
      data-slot="field"
    >
      {{ label }}
    </Text>
    <Group gap="2" align="center" justify="between" class="h-8 w-full" data-slot="composer-tools">
      <Group gap="2" align="center">
        <Button
          variant="ghost"
          size="sm"
          layout="icon"
          class="bg-background/10 text-background hover:bg-background/20"
          :aria-label="(attachLabel ?? 'Attach')"
        >
          <LucideIcon name="plus" :size="16" />
        </Button>
        <Button v-if="modelLabel"
          variant="ghost"
          size="sm"
          :class="cn('gap-2 bg-background/10 text-background hover:bg-background/20', defaults.hero.model)"
        >
          <LucideIcon name="sparkles" :size="16" />
          {{ modelLabel }}
          <LucideIcon name="chevron-down" :size="16" />
        </Button>
      </Group>
      <Button :href="urlOf(href)" variant="secondary" size="sm" layout="icon" :aria-label="(send ?? 'Send')">
        <LucideIcon name="arrow-up" :size="16" />
      </Button>
    </Group>
  </Box>
</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 prompt-composer
components/prompt-composer.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.
/**
 * A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send
 * button. Static links only; a host adds behavior.
 */
import { type JSX } from "solid-js";
import { Box, Button, Group, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { defaults } from "../presets/defaults";
import { cn, urlOf } from "../utils";

export type PromptComposerProps = {
  label?: string;
  attachLabel?: string;
  modelLabel?: string;
  send?: string;
  href?: string;
};

export function PromptComposer({ label, attachLabel, modelLabel, send, href }: PromptComposerProps) {
  return (
    <Box
      class={cn(
        "mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30",
        defaults.hero.composer
      )}
      data-slot="email-form"
    >
      {attachLabel ? (
        <Group gap="2" align="center" data-slot="composer-attachments">
          <Button
            variant="ghost"
            size="sm"
            class={cn(
              "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
              defaults.hero.attach
            )}
          >
            <LucideIcon name="file-text" size={16} />
            {attachLabel}
          </Button>
          <Button
            variant="ghost"
            size="sm"
            class={cn(
              "gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20",
              defaults.hero.attach
            )}
          >
            <LucideIcon name="paperclip" size={16} />
            {attachLabel}
          </Button>
        </Group>
      ) : null}
      <Text
        size="xs"
        weight="semibold"
        class={cn("flex w-full items-center leading-5 text-background/80", defaults.hero.promptLine)}
        data-slot="field"
      >
        {label}
      </Text>
      <Group gap="2" align="center" justify="between" class="h-8 w-full" data-slot="composer-tools">
        <Group gap="2" align="center">
          <Button
            variant="ghost"
            size="sm"
            layout="icon"
            class="bg-background/10 text-background hover:bg-background/20"
            aria-label={(attachLabel ?? "Attach")}
          >
            <LucideIcon name="plus" size={16} />
          </Button>
          {modelLabel ? (
            <Button
              variant="ghost"
              size="sm"
              class={cn("gap-2 bg-background/10 text-background hover:bg-background/20", defaults.hero.model)}
            >
              <LucideIcon name="sparkles" size={16} />
              {modelLabel}
              <LucideIcon name="chevron-down" size={16} />
            </Button>
          ) : null}
        </Group>
        <Button href={urlOf(href)} variant="secondary" size="sm" layout="icon" aria-label={(send ?? "Send")}>
          <LucideIcon name="arrow-up" size={16} />
        </Button>
      </Group>
    </Box>
  );
}

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 prompt-composer
blocks/prompt-composer.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/prompt-composer.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/ui/button"
	"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"
)

// PromptComposerProps are the props of PromptComposer; the values are the JSON shapes of the TypeScript props.
type PromptComposerProps struct {
	Label any `json:"label"`
	AttachLabel any `json:"attachLabel"`
	ModelLabel any `json:"modelLabel"`
	Send any `json:"send"`
	Href any `json:"href"`
}

// A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send button. Static links only; a host adds behavior.
templ PromptComposer(p PromptComposerProps) {
	{{ vLabel := p.Label }}
	{{ vAttachLabel := p.AttachLabel }}
	{{ vModelLabel := p.ModelLabel }}
	{{ vSend := p.Send }}
	{{ vHref := p.Href }}
	@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30", uiutils.Get(presetDefaults, "hero", "composer"))), Attrs: uiutils.Attrs("data-slot", "email-form")}}) {
		if uiutils.T(vAttachLabel) {
			@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "composer-attachments")}}) {
				@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", ButtonProps: button.ButtonProps{Class: uiutils.S(uiutils.Cnv("gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20", uiutils.Get(presetDefaults, "hero", "attach")))}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "file-text", Size: 16})
					{ uiutils.Text(vAttachLabel) }
				}
				@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", ButtonProps: button.ButtonProps{Class: uiutils.S(uiutils.Cnv("gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20", uiutils.Get(presetDefaults, "hero", "attach")))}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "paperclip", Size: 16})
					{ uiutils.Text(vAttachLabel) }
				}
			}
		}
		@compose.Text(compose.TextProps{Size: "xs", Weight: "semibold", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cnv("flex w-full items-center leading-5 text-background/80", uiutils.Get(presetDefaults, "hero", "promptLine"))), Attrs: uiutils.Attrs("data-slot", "field")}}) {
			{ uiutils.Text(vLabel) }
		}
		@compose.Group(compose.GroupProps{Gap: "2", Align: "center", Justify: "between", BoxProps: box.BoxProps{Class: "h-8 w-full", Attrs: uiutils.Attrs("data-slot", "composer-tools")}}) {
			@compose.Group(compose.GroupProps{Gap: "2", Align: "center", BoxProps: box.BoxProps{}}) {
				@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", Layout: "icon", ButtonProps: button.ButtonProps{Class: "bg-background/10 text-background hover:bg-background/20", Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vAttachLabel, "Attach"))}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: "plus", Size: 16})
				}
				if uiutils.T(vModelLabel) {
					@compose.Button(compose.ButtonProps{Variant: "ghost", Size: "sm", ButtonProps: button.ButtonProps{Class: uiutils.S(uiutils.Cnv("gap-2 bg-background/10 text-background hover:bg-background/20", uiutils.Get(presetDefaults, "hero", "model")))}}) {
						@icons.LucideIcon(icons.LucideIconProps{Name: "sparkles", Size: 16})
						{ uiutils.Text(vModelLabel) }
						@icons.LucideIcon(icons.LucideIconProps{Name: "chevron-down", Size: 16})
					}
				}
			}
			@compose.Button(compose.ButtonProps{Variant: "secondary", Size: "sm", Layout: "icon", ButtonProps: button.ButtonProps{Href: uiutils.URL(vHref, false), Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vSend, "Send"))}}) {
				@icons.LucideIcon(icons.LucideIconProps{Name: "arrow-up", Size: 16})
			}
		}
	}
}

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 prompt-composer
blocks/prompt-composer.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/prompt-composer.json
    A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send button. Static links only; a host adds behavior.
    Props (p): label, attachLabel, modelLabel, send, href. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set v_attachLabel = (p.attachLabel ?? null) -%}
{%- set v_modelLabel = (p.modelLabel ?? null) -%}
{%- set v_send = (p.send ?? null) -%}
{%- set v_href = (p.href ?? null) -%}
{%- set c_10 -%}
  {%- if og_t(v_attachLabel) %}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'file-text', 'size': 16}, with_context = false) }}
        {{ og_text(v_attachLabel) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'class': og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])])), 'children': c_1}, with_context = false) }}
      {%- set c_2 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'paperclip', 'size': 16}, with_context = false) }}
        {{ og_text(v_attachLabel) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'class': og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])])), 'children': c_2}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'attrs': og_attrs(['data-slot', 'composer-attachments']), 'children': c_3}, with_context = false) }}
  {%- endif %}
  {%- set c_4 -%}
    {{ og_text(v_label) }}
  {%- endset -%}
  {{ include('compose/Text.html.twig', {'size': 'xs', 'weight': 'semibold', 'class': og_s(og_cnv(['flex w-full items-center leading-5 text-background/80', og_preset('blocks/presets/defaults.json', ['hero', 'promptLine'])])), 'attrs': og_attrs(['data-slot', 'field']), 'children': c_4}, with_context = false) }}
  {%- set c_9 -%}
    {%- set c_7 -%}
      {%- set c_5 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': 'plus', 'size': 16}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'layout': 'icon', 'class': 'bg-background/10 text-background hover:bg-background/20', 'attrs': og_attrs(['aria-label', og_coalesce([v_attachLabel, 'Attach'])]), 'children': c_5}, with_context = false) }}
      {%- if og_t(v_modelLabel) %}
        {%- set c_6 -%}
          {{ include('icons/LucideIcon.html.twig', {'name': 'sparkles', 'size': 16}, with_context = false) }}
          {{ og_text(v_modelLabel) }}
          {{ include('icons/LucideIcon.html.twig', {'name': 'chevron-down', 'size': 16}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Button.html.twig', {'variant': 'ghost', 'size': 'sm', 'class': og_s(og_cnv(['gap-2 bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'model'])])), 'children': c_6}, with_context = false) }}
      {%- endif %}
    {%- endset -%}
    {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'children': c_7}, with_context = false) }}
    {%- set c_8 -%}
      {{ include('icons/LucideIcon.html.twig', {'name': 'arrow-up', 'size': 16}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Button.html.twig', {'href': og_url(og_s(v_href)), 'variant': 'secondary', 'size': 'sm', 'layout': 'icon', 'attrs': og_attrs(['aria-label', og_coalesce([v_send, 'Send'])]), 'children': c_8}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Group.html.twig', {'gap': '2', 'align': 'center', 'justify': 'between', 'class': 'h-8 w-full', 'attrs': og_attrs(['data-slot', 'composer-tools']), 'children': c_9}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30', og_preset('blocks/presets/defaults.json', ['hero', 'composer'])])), 'attrs': og_attrs(['data-slot', 'email-form']), 'children': c_10}, 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 prompt-composer
blocks/prompt-composer.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/prompt-composer.json
    A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send button. Static links only; a host adds behavior.
    Props (p): label, attachLabel, modelLabel, send, href. *}
{var $v_label = ($p['label'] ?? null)}
{var $v_attachLabel = ($p['attachLabel'] ?? null)}
{var $v_modelLabel = ($p['modelLabel'] ?? null)}
{var $v_send = ($p['send'] ?? null)}
{var $v_href = ($p['href'] ?? null)}
{capture $c_10}
  {if og_t($v_attachLabel)}
    {capture $c_3}
      {capture $c_1}
        {=og_include('icons/LucideIcon.latte', ['name' => 'file-text', 'size' => 16])|noescape}
        {=og_text($v_attachLabel)}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'class' => og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])])), 'children' => (string) $c_1])|noescape}
      {capture $c_2}
        {=og_include('icons/LucideIcon.latte', ['name' => 'paperclip', 'size' => 16])|noescape}
        {=og_text($v_attachLabel)}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'class' => og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])])), 'children' => (string) $c_2])|noescape}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'attrs' => og_attrs(['data-slot', 'composer-attachments']), 'children' => (string) $c_3])|noescape}
  {/if}
  {capture $c_4}
    {=og_text($v_label)}
  {/capture}
  {=og_include('compose/Text.latte', ['size' => 'xs', 'weight' => 'semibold', 'class' => og_s(og_cnv(['flex w-full items-center leading-5 text-background/80', og_preset('blocks/presets/defaults.json', ['hero', 'promptLine'])])), 'attrs' => og_attrs(['data-slot', 'field']), 'children' => (string) $c_4])|noescape}
  {capture $c_9}
    {capture $c_7}
      {capture $c_5}
        {=og_include('icons/LucideIcon.latte', ['name' => 'plus', 'size' => 16])|noescape}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'layout' => 'icon', 'class' => 'bg-background/10 text-background hover:bg-background/20', 'attrs' => og_attrs(['aria-label', og_coalesce([$v_attachLabel, 'Attach'])]), 'children' => (string) $c_5])|noescape}
      {if og_t($v_modelLabel)}
        {capture $c_6}
          {=og_include('icons/LucideIcon.latte', ['name' => 'sparkles', 'size' => 16])|noescape}
          {=og_text($v_modelLabel)}
          {=og_include('icons/LucideIcon.latte', ['name' => 'chevron-down', 'size' => 16])|noescape}
        {/capture}
        {=og_include('compose/Button.latte', ['variant' => 'ghost', 'size' => 'sm', 'class' => og_s(og_cnv(['gap-2 bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'model'])])), 'children' => (string) $c_6])|noescape}
      {/if}
    {/capture}
    {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'children' => (string) $c_7])|noescape}
    {capture $c_8}
      {=og_include('icons/LucideIcon.latte', ['name' => 'arrow-up', 'size' => 16])|noescape}
    {/capture}
    {=og_include('compose/Button.latte', ['href' => og_url(og_s($v_href)), 'variant' => 'secondary', 'size' => 'sm', 'layout' => 'icon', 'attrs' => og_attrs(['aria-label', og_coalesce([$v_send, 'Send'])]), 'children' => (string) $c_8])|noescape}
  {/capture}
  {=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'center', 'justify' => 'between', 'class' => 'h-8 w-full', 'attrs' => og_attrs(['data-slot', 'composer-tools']), 'children' => (string) $c_9])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30', og_preset('blocks/presets/defaults.json', ['hero', 'composer'])])), 'attrs' => og_attrs(['data-slot', 'email-form']), 'children' => (string) $c_10])|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 prompt-composer
blocks/prompt-composer.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/prompt-composer.json
    A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send button. Static links only; a host adds behavior.
    Props (p): label, attachLabel, modelLabel, send, href. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set v_attachLabel = og_def(p['attachLabel'], none) -%}
{%- set v_modelLabel = og_def(p['modelLabel'], none) -%}
{%- set v_send = og_def(p['send'], none) -%}
{%- set v_href = og_def(p['href'], none) -%}
{%- set c_10 -%}
  {%- if og_t(v_attachLabel) %}
    {%- set c_3 -%}
      {%- set c_1 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'file-text', 'Size': 16}}) }}
        {{ og_text(v_attachLabel) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Class': og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])]))}, 'children': c_1}) }}
      {%- set c_2 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'paperclip', 'Size': 16}}) }}
        {{ og_text(v_attachLabel) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Class': og_s(og_cnv(['gap-2 overflow-hidden bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'attach'])]))}, 'children': c_2}) }}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Attrs': og_attrs(['data-slot', 'composer-attachments'])}, 'children': c_3}) }}
  {%- endif %}
  {%- set c_4 -%}
    {{ og_text(v_label) }}
  {%- endset -%}
  {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Weight': 'semibold', 'Class': og_s(og_cnv(['flex w-full items-center leading-5 text-background/80', og_preset('blocks/presets/defaults.json', ['hero', 'promptLine'])])), 'Attrs': og_attrs(['data-slot', 'field'])}, 'children': c_4}) }}
  {%- set c_9 -%}
    {%- set c_7 -%}
      {%- set c_5 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'plus', 'Size': 16}}) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Layout': 'icon', 'Class': 'bg-background/10 text-background hover:bg-background/20', 'Attrs': og_attrs(['aria-label', og_coalesce([v_attachLabel, 'Attach'])])}, 'children': c_5}) }}
      {%- if og_t(v_modelLabel) %}
        {%- set c_6 -%}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'sparkles', 'Size': 16}}) }}
          {{ og_text(v_modelLabel) }}
          {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'chevron-down', 'Size': 16}}) }}
        {%- endset -%}
        {{ og_include('compose/button.html.j2', {'p': {'Variant': 'ghost', 'Size': 'sm', 'Class': og_s(og_cnv(['gap-2 bg-background/10 text-background hover:bg-background/20', og_preset('blocks/presets/defaults.json', ['hero', 'model'])]))}, 'children': c_6}) }}
      {%- endif %}
    {%- endset -%}
    {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center'}, 'children': c_7}) }}
    {%- set c_8 -%}
      {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'arrow-up', 'Size': 16}}) }}
    {%- endset -%}
    {{ og_include('compose/button.html.j2', {'p': {'Href': og_url(og_s(v_href)), 'Variant': 'secondary', 'Size': 'sm', 'Layout': 'icon', 'Attrs': og_attrs(['aria-label', og_coalesce([v_send, 'Send'])])}, 'children': c_8}) }}
  {%- endset -%}
  {{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'center', 'Justify': 'between', 'Class': 'h-8 w-full', 'Attrs': og_attrs(['data-slot', 'composer-tools'])}, 'children': c_9}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['mx-auto flex w-full flex-col gap-4 bg-background/10 p-6 inset-ring inset-ring-background/30', og_preset('blocks/presets/defaults.json', ['hero', 'composer'])])), 'Attrs': og_attrs(['data-slot', 'email-form'])}, 'children': c_10}) }}

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.

A prompt box on a dark band: attachment chips, the prompt line, a plus button, the model pill and a send button. Static links only; a host adds behavior.

Props of PromptComposer
PropTypeDefault Description
label string-the prompt line (To Build Site)
attachLabel string-attachment chip label
modelLabel string-model pill label
send string-accessible name of the send button
href string-

Used in