Skip to content
ui8kit

block / general

Cta Banner

Cta Banner block

Install

npx ui8kit add cta-banner

Pulls in: block, box, button, compose, kit-box, kit-button, kit-text, presets, text, title, utils

Preview

AI-powered website builder with ready-to-use templates

Generate complete HTML, CSS, and JavaScript projects in minutes — just pick a template and share your idea.

Get Started

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 cta-banner
blocks/cta-banner.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 centered closing card: heading, one sentence and a pill button. Sizes from the default preset. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";

  export type CtaBannerProps = {
    id: string;
    title: string;
    text: string;
    cta: string;
    href?: string;
    tone?: "default" | "muted";
    landmarkLabel?: string;
  };
</script>

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

  let { id, title, text, cta, href, tone = "muted", landmarkLabel }: CtaBannerProps = $props();
</script>

<Block
  tag="section"
  class="w-full py-0"
  aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
  data-tone={tone}
  data-density="compact"
  aria-label={landmarkLabel}
  data-slot="section"
>
  <Box
    class={cn("flex w-full flex-col items-center gap-10 bg-muted px-6 text-center", defaults.cta.panel)}
    data-slot="cta-banner"
  >
    <Title
      as={2}
      size="3xl"
      weight="semibold"
      class={cn(defaults.cta.title, "leading-9")}
      id={tpl("{0}-title", id)}
    >
      {title}
    </Title>
    <Text size="xs" weight="semibold" class={cn("leading-5 text-muted-foreground", defaults.cta.text)}>
      {text}
    </Text>
    <Button variant="default" size="lg" href={urlOf(href)} class={defaults.cta.button}>
      {cta}
    </Button>
  </Box>
</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 cta-banner
blocks/cta-banner.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 centered closing card: heading, one sentence and a pill button. Sizes from the default preset. */
import { type ReactNode } from "react";
import { Block, Box, Button, Text, Title } from "../compose";
import { defaults } from "../presets/defaults";
import { cn, tpl, urlOf } from "../utils";

export type CtaBannerProps = {
  id: string;
  title: string;
  text: string;
  cta: string;
  href?: string;
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function CtaBanner({ id, title, text, cta, href, tone = "muted", landmarkLabel }: CtaBannerProps) {
  return (
    <Block
      tag="section"
      className="w-full py-0"
      aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
      data-tone={tone}
      data-density="compact"
      aria-label={landmarkLabel}
      data-slot="section"
    >
      <Box
        className={cn(
          "flex w-full flex-col items-center gap-10 bg-muted px-6 text-center",
          defaults.cta.panel
        )}
        data-slot="cta-banner"
      >
        <Title
          as={2}
          size="3xl"
          weight="semibold"
          className={cn(defaults.cta.title, "leading-9")}
          id={tpl("{0}-title", id)}
        >
          {title}
        </Title>
        <Text size="xs" weight="semibold" className={cn("leading-5 text-muted-foreground", defaults.cta.text)}>
          {text}
        </Text>
        <Button variant="default" size="lg" href={urlOf(href)} className={defaults.cta.button}>
          {cta}
        </Button>
      </Box>
    </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 cta-banner
blocks/cta-banner.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 centered closing card: heading, one sentence and a pill button. Sizes from the default preset. -->
<script lang="ts">
export type CtaBannerProps = {
  id: string;
  title: string;
  text: string;
  cta: string;
  href?: string;
  tone?: "default" | "muted";
  landmarkLabel?: string;
};
</script>

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

const { id, title, text, cta, href, tone = "muted", landmarkLabel } = defineProps<CtaBannerProps>();
</script>

<template>
  <Block
    tag="section"
    class="w-full py-0"
    :aria-labelledby="(landmarkLabel ? undefined : tpl('{0}-title', id))"
    :data-tone="tone"
    data-density="compact"
    :aria-label="landmarkLabel"
    data-slot="section"
  >
    <Box
      :class="cn('flex w-full flex-col items-center gap-10 bg-muted px-6 text-center', defaults.cta.panel)"
      data-slot="cta-banner"
    >
      <Title
        :as="2"
        size="3xl"
        weight="semibold"
        :class="cn(defaults.cta.title, 'leading-9')"
        :id="tpl('{0}-title', id)"
      >
        {{ title }}
      </Title>
      <Text size="xs" weight="semibold" :class="cn('leading-5 text-muted-foreground', defaults.cta.text)">
        {{ text }}
      </Text>
      <Button variant="default" size="lg" :href="urlOf(href)" :class="defaults.cta.button">
        {{ cta }}
      </Button>
    </Box>
  </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 cta-banner
blocks/cta-banner.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 centered closing card: heading, one sentence and a pill button. Sizes from the default preset. */
import { type JSX } from "solid-js";
import { Block, Box, Button, Text, Title } from "../compose";
import { defaults } from "../presets/defaults";
import { cn, tpl, urlOf } from "../utils";

export type CtaBannerProps = {
  id: string;
  title: string;
  text: string;
  cta: string;
  href?: string;
  tone?: "default" | "muted";
  landmarkLabel?: string;
};

export function CtaBanner({ id, title, text, cta, href, tone = "muted", landmarkLabel }: CtaBannerProps) {
  return (
    <Block
      tag="section"
      class="w-full py-0"
      aria-labelledby={(landmarkLabel ? undefined : tpl("{0}-title", id))}
      data-tone={tone}
      data-density="compact"
      aria-label={landmarkLabel}
      data-slot="section"
    >
      <Box
        class={cn("flex w-full flex-col items-center gap-10 bg-muted px-6 text-center", defaults.cta.panel)}
        data-slot="cta-banner"
      >
        <Title
          as={2}
          size="3xl"
          weight="semibold"
          class={cn(defaults.cta.title, "leading-9")}
          id={tpl("{0}-title", id)}
        >
          {title}
        </Title>
        <Text size="xs" weight="semibold" class={cn("leading-5 text-muted-foreground", defaults.cta.text)}>
          {text}
        </Text>
        <Button variant="default" size="lg" href={urlOf(href)} class={defaults.cta.button}>
          {cta}
        </Button>
      </Box>
    </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 cta-banner
blocks/cta-banner.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/cta-banner.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/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// CtaBannerProps are the props of CtaBanner; the values are the JSON shapes of the TypeScript props.
type CtaBannerProps struct {
	Id any `json:"id"`
	Title any `json:"title"`
	Text any `json:"text"`
	Cta any `json:"cta"`
	Href any `json:"href"`
	Tone any `json:"tone"`
	LandmarkLabel any `json:"landmarkLabel"`
}

// A centered closing card: heading, one sentence and a pill button. Sizes from the default preset.
templ CtaBanner(p CtaBannerProps) {
	{{ vId := p.Id }}
	{{ vTitle := p.Title }}
	{{ vText := p.Text }}
	{{ vCta := p.Cta }}
	{{ vHref := p.Href }}
	{{ vTone := uiutils.Def(p.Tone, "muted") }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "section", Class: "w-full py-0", Attrs: uiutils.Attrs("aria-labelledby", uiutils.Cond(uiutils.T(vLandmarkLabel), nil, uiutils.Tpl("{0}-title", vId)), "data-tone", vTone, "data-density", "compact", "aria-label", vLandmarkLabel, "data-slot", "section")}}) {
		@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex w-full flex-col items-center gap-10 bg-muted px-6 text-center", uiutils.Get(presetDefaults, "cta", "panel"))), Attrs: uiutils.Attrs("data-slot", "cta-banner")}}) {
			@compose.Title(compose.TitleProps{As: "2", Size: "3xl", Weight: "semibold", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cnv(uiutils.Get(presetDefaults, "cta", "title"), "leading-9")), Attrs: uiutils.Attrs("id", uiutils.Tpl("{0}-title", vId))}}) {
				{ uiutils.Text(vTitle) }
			}
			@compose.Text(compose.TextProps{Size: "xs", Weight: "semibold", TextProps: text.TextProps{Class: uiutils.S(uiutils.Cnv("leading-5 text-muted-foreground", uiutils.Get(presetDefaults, "cta", "text")))}}) {
				{ uiutils.Text(vText) }
			}
			@compose.Button(compose.ButtonProps{Variant: "default", Size: "lg", ButtonProps: button.ButtonProps{Href: uiutils.URL(vHref, false), Class: uiutils.S(uiutils.Get(presetDefaults, "cta", "button"))}}) {
				{ uiutils.Text(vCta) }
			}
		}
	}
}

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 cta-banner
blocks/cta-banner.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/cta-banner.json
    A centered closing card: heading, one sentence and a pill button. Sizes from the default preset.
    Props (p): id, title, text, cta, href, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_text = (p.text ?? null) -%}
{%- set v_cta = (p.cta ?? null) -%}
{%- set v_href = (p.href ?? null) -%}
{%- set v_tone = (p.tone ?? 'muted') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_5 -%}
  {%- set c_4 -%}
    {%- set c_1 -%}
      {{ og_text(v_title) }}
    {%- endset -%}
    {{ include('compose/Title.html.twig', {'as': 2, 'size': '3xl', 'weight': 'semibold', 'class': og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['cta', 'title']), 'leading-9'])), 'attrs': og_attrs(['id', og_tpl('{0}-title', [v_id])]), 'children': c_1}, with_context = false) }}
    {%- set c_2 -%}
      {{ og_text(v_text) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'xs', 'weight': 'semibold', 'class': og_s(og_cnv(['leading-5 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['cta', 'text'])])), 'children': c_2}, with_context = false) }}
    {%- set c_3 -%}
      {{ og_text(v_cta) }}
    {%- endset -%}
    {{ include('compose/Button.html.twig', {'variant': 'default', 'size': 'lg', 'href': og_url(og_s(v_href)), 'class': og_s(og_preset('blocks/presets/defaults.json', ['cta', 'button'])), 'children': c_3}, with_context = false) }}
  {%- endset -%}
  {{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['flex w-full flex-col items-center gap-10 bg-muted px-6 text-center', og_preset('blocks/presets/defaults.json', ['cta', 'panel'])])), 'attrs': og_attrs(['data-slot', 'cta-banner']), 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'section', 'class': 'w-full py-0', 'attrs': og_attrs(['aria-labelledby', (og_t(v_landmarkLabel) ? null : og_tpl('{0}-title', [v_id])), 'data-tone', v_tone, 'data-density', 'compact', 'aria-label', v_landmarkLabel, 'data-slot', 'section']), 'children': c_5}, 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 cta-banner
blocks/cta-banner.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/cta-banner.json
    A centered closing card: heading, one sentence and a pill button. Sizes from the default preset.
    Props (p): id, title, text, cta, href, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_text = ($p['text'] ?? null)}
{var $v_cta = ($p['cta'] ?? null)}
{var $v_href = ($p['href'] ?? null)}
{var $v_tone = ($p['tone'] ?? 'muted')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_5}
  {capture $c_4}
    {capture $c_1}
      {=og_text($v_title)}
    {/capture}
    {=og_include('compose/Title.latte', ['as' => 2, 'size' => '3xl', 'weight' => 'semibold', 'class' => og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['cta', 'title']), 'leading-9'])), 'attrs' => og_attrs(['id', og_tpl('{0}-title', [$v_id])]), 'children' => (string) $c_1])|noescape}
    {capture $c_2}
      {=og_text($v_text)}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'xs', 'weight' => 'semibold', 'class' => og_s(og_cnv(['leading-5 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['cta', 'text'])])), 'children' => (string) $c_2])|noescape}
    {capture $c_3}
      {=og_text($v_cta)}
    {/capture}
    {=og_include('compose/Button.latte', ['variant' => 'default', 'size' => 'lg', 'href' => og_url(og_s($v_href)), 'class' => og_s(og_preset('blocks/presets/defaults.json', ['cta', 'button'])), 'children' => (string) $c_3])|noescape}
  {/capture}
  {=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['flex w-full flex-col items-center gap-10 bg-muted px-6 text-center', og_preset('blocks/presets/defaults.json', ['cta', 'panel'])])), 'attrs' => og_attrs(['data-slot', 'cta-banner']), 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'section', 'class' => 'w-full py-0', 'attrs' => og_attrs(['aria-labelledby', (og_t($v_landmarkLabel) ? null : og_tpl('{0}-title', [$v_id])), 'data-tone', $v_tone, 'data-density', 'compact', 'aria-label', $v_landmarkLabel, 'data-slot', 'section']), 'children' => (string) $c_5])|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 cta-banner
blocks/cta-banner.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/cta-banner.json
    A centered closing card: heading, one sentence and a pill button. Sizes from the default preset.
    Props (p): id, title, text, cta, href, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_text = og_def(p['text'], none) -%}
{%- set v_cta = og_def(p['cta'], none) -%}
{%- set v_href = og_def(p['href'], none) -%}
{%- set v_tone = og_def(p['tone'], 'muted') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_5 -%}
  {%- set c_4 -%}
    {%- set c_1 -%}
      {{ og_text(v_title) }}
    {%- endset -%}
    {{ og_include('compose/title.html.j2', {'p': {'As': 2, 'Size': '3xl', 'Weight': 'semibold', 'Class': og_s(og_cnv([og_preset('blocks/presets/defaults.json', ['cta', 'title']), 'leading-9'])), 'Attrs': og_attrs(['id', og_tpl('{0}-title', [v_id])])}, 'children': c_1}) }}
    {%- set c_2 -%}
      {{ og_text(v_text) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Weight': 'semibold', 'Class': og_s(og_cnv(['leading-5 text-muted-foreground', og_preset('blocks/presets/defaults.json', ['cta', 'text'])]))}, 'children': c_2}) }}
    {%- set c_3 -%}
      {{ og_text(v_cta) }}
    {%- endset -%}
    {{ og_include('compose/button.html.j2', {'p': {'Variant': 'default', 'Size': 'lg', 'Href': og_url(og_s(v_href)), 'Class': og_s(og_preset('blocks/presets/defaults.json', ['cta', 'button']))}, 'children': c_3}) }}
  {%- endset -%}
  {{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['flex w-full flex-col items-center gap-10 bg-muted px-6 text-center', og_preset('blocks/presets/defaults.json', ['cta', 'panel'])])), 'Attrs': og_attrs(['data-slot', 'cta-banner'])}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'section', 'Class': 'w-full py-0', 'Attrs': og_attrs(['aria-labelledby', (none if og_t(v_landmarkLabel) else og_tpl('{0}-title', [v_id])), 'data-tone', v_tone, 'data-density', 'compact', 'aria-label', v_landmarkLabel, 'data-slot', 'section'])}, 'children': c_5}) }}

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 centered closing card: heading, one sentence and a pill button. Sizes from the default preset.

Props of CtaBanner
PropTypeDefault Description
id (required)string-
title (required)string-
text (required)string-
cta (required)string-
href string-the address; none: a button, not a link
tone "default" | "muted""muted"
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one

Used in