Skip to content
ui8kit

component / components

Media Contacts

Media Contacts component

Install

npx ui8kit add media-contacts

Pulls in: button, compose, group, kit-box, kit-button, kit-text, lucide-icon, media-list, stack, text, utils

Preview

Get help

Support in numbers

Sites published

12,400

Uptime

99.99%

Teams

3,200

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 media-contacts
components/media-contacts.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. -->
<!-- The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

  export type MediaContactsProps = {
    extras: MediaExtras;
    labels: MediaListLabels;
  };
</script>

<script lang="ts">
  import Button from "../compose/Button.svelte";
  import Group from "../compose/Group.svelte";
  import LucideIcon from "../icons/LucideIcon.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import { urlOf } from "../utils";

  let { extras, labels }: MediaContactsProps = $props();
</script>

<Stack gap="6" align="stretch" data-slot="media-contacts">
  <Stack gap="2" align="stretch">
    <Text size="sm" weight="semibold">
      {labels.list}
    </Text>
    {#each extras.channels as c, i (c.id)}
      <Button variant="outline" size="default" href={urlOf(c.href)} class="w-full gap-2">
        <LucideIcon name={c.icon} size={16} />
        {c.title}
      </Button>
    {/each}
  </Stack>
  <Stack gap="2" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-4">
    <Text size="sm" weight="semibold">
      {labels.figures}
    </Text>
    {#each extras.stats as s, i (s.id)}
      {#if (i < 3)}
        <Group gap="4" align="center" justify="between" data-slot="media-stat">
          <Text size="sm" class="text-muted-foreground">
            {s.label}
          </Text>
          <Text size="sm" weight="semibold">
            {s.value}
          </Text>
        </Group>
      {/if}
    {/each}
  </Stack>
</Stack>

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 media-contacts
components/media-contacts.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.
/** The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card. */
import { Fragment, type ReactNode } from "react";
import { Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { urlOf } from "../utils";
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaContactsProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};

export function MediaContacts({ extras, labels }: MediaContactsProps) {
  return (
    <Stack gap="6" align="stretch" data-slot="media-contacts">
      <Stack gap="2" align="stretch">
        <Text size="sm" weight="semibold">
          {labels.list}
        </Text>
        {(extras.channels ?? []).map((c, i) => (
          <Button key={c.id} variant="outline" size="default" href={urlOf(c.href)} className="w-full gap-2">
            <LucideIcon name={c.icon} size={16} />
            {c.title}
          </Button>
        ))}
      </Stack>
      <Stack gap="2" align="stretch" className="rounded bg-card inset-ring inset-ring-border p-4">
        <Text size="sm" weight="semibold">
          {labels.figures}
        </Text>
        {(extras.stats ?? []).map((s, i) => (
          <Fragment key={s.id}>
            {(i < 3) ? (
              <Group gap="4" align="center" justify="between" data-slot="media-stat">
                <Text size="sm" className="text-muted-foreground">
                  {s.label}
                </Text>
                <Text size="sm" weight="semibold">
                  {s.value}
                </Text>
              </Group>
            ) : null}
          </Fragment>
        ))}
      </Stack>
    </Stack>
  );
}

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 media-contacts
components/media-contacts.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. -->
<!-- The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card. -->
<script lang="ts">
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaContactsProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};
</script>

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

const { extras, labels } = defineProps<MediaContactsProps>();
</script>

<template>
  <Stack gap="6" align="stretch" data-slot="media-contacts">
    <Stack gap="2" align="stretch">
      <Text size="sm" weight="semibold">
        {{ labels.list }}
      </Text>
      <Button
        v-for="(c, i) in extras.channels"
        :key="c.id"
        variant="outline"
        size="default"
        :href="urlOf(c.href)"
        class="w-full gap-2"
      >
        <LucideIcon :name="c.icon" :size="16" />
        {{ c.title }}
      </Button>
    </Stack>
    <Stack gap="2" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-4">
      <Text size="sm" weight="semibold">
        {{ labels.figures }}
      </Text>
      <template v-for="(s, i) in extras.stats" :key="s.id">
        <Group v-if="(i < 3)" gap="4" align="center" justify="between" data-slot="media-stat">
          <Text size="sm" class="text-muted-foreground">
            {{ s.label }}
          </Text>
          <Text size="sm" weight="semibold">
            {{ s.value }}
          </Text>
        </Group>
      </template>
    </Stack>
  </Stack>
</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 media-contacts
components/media-contacts.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.
/** The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card. */
import { For, type JSX } from "solid-js";
import { Button, Group, Stack, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
import { urlOf } from "../utils";
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaContactsProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};

export function MediaContacts({ extras, labels }: MediaContactsProps) {
  return (
    <Stack gap="6" align="stretch" data-slot="media-contacts">
      <Stack gap="2" align="stretch">
        <Text size="sm" weight="semibold">
          {labels.list}
        </Text>
        <For each={extras.channels ?? []}>{(c, iOf) => { const i = iOf(); return (
          <Button variant="outline" size="default" href={urlOf(c.href)} class="w-full gap-2">
            <LucideIcon name={c.icon} size={16} />
            {c.title}
          </Button>
        ); }}</For>
      </Stack>
      <Stack gap="2" align="stretch" class="rounded bg-card inset-ring inset-ring-border p-4">
        <Text size="sm" weight="semibold">
          {labels.figures}
        </Text>
        <For each={extras.stats ?? []}>{(s, iOf) => { const i = iOf(); return (
          <>
            {(i < 3) ? (
              <Group gap="4" align="center" justify="between" data-slot="media-stat">
                <Text size="sm" class="text-muted-foreground">
                  {s.label}
                </Text>
                <Text size="sm" weight="semibold">
                  {s.value}
                </Text>
              </Group>
            ) : null}
          </>
        ); }}</For>
      </Stack>
    </Stack>
  );
}

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 media-contacts
blocks/media-contacts.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/media-contacts.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"
)

// MediaContactsProps are the props of MediaContacts; the values are the JSON shapes of the TypeScript props.
type MediaContactsProps struct {
	Extras any `json:"extras"`
	Labels any `json:"labels"`
}

// The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card.
templ MediaContacts(p MediaContactsProps) {
	{{ vExtras := p.Extras }}
	{{ vLabels := p.Labels }}
	@compose.Stack(compose.StackProps{Gap: "6", Align: "stretch", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "media-contacts")}}) {
		@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{}}) {
			@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Get(vLabels, "list")) }
			}
			for _, vC := range uiutils.L(uiutils.Get(vExtras, "channels")) {
				@compose.Button(compose.ButtonProps{Variant: "outline", Size: "default", ButtonProps: button.ButtonProps{Href: uiutils.URL(uiutils.Get(vC, "href"), false), Class: "w-full gap-2"}}) {
					@icons.LucideIcon(icons.LucideIconProps{Name: uiutils.S(uiutils.Get(vC, "icon")), Size: 16})
					{ uiutils.Text(uiutils.Get(vC, "title")) }
				}
			}
		}
		@compose.Stack(compose.StackProps{Gap: "2", Align: "stretch", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4"}}) {
			@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
				{ uiutils.Text(uiutils.Get(vLabels, "figures")) }
			}
			for vI, vS := range uiutils.L(uiutils.Get(vExtras, "stats")) {
				if uiutils.Lt(float64(vI), float64(3)) {
					@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "media-stat")}}) {
						@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Get(vS, "label")) }
						}
						@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vS, "value")) }
						}
					}
				}
			}
		}
	}
}

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 media-contacts
blocks/media-contacts.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/media-contacts.json
    The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card.
    Props (p): extras, labels. -#}
{%- set v_extras = (p.extras ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set c_9 -%}
  {%- set c_3 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['list'])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
    {%- for v_c in og_l(og_get(v_extras, ['channels'])) %}
      {%- set v_i = loop.index0 -%}
      {%- set c_2 -%}
        {{ include('icons/LucideIcon.html.twig', {'name': og_s(og_get(v_c, ['icon'])), 'size': 16}, with_context = false) }}
        {{ og_text(og_get(v_c, ['title'])) }}
      {%- endset -%}
      {{ include('compose/Button.html.twig', {'variant': 'outline', 'size': 'default', 'href': og_url(og_s(og_get(v_c, ['href']))), 'class': 'w-full gap-2', 'children': c_2}, with_context = false) }}
    {%- endfor %}
  {%- endset -%}
  {{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'children': c_3}, with_context = false) }}
  {%- set c_8 -%}
    {%- set c_4 -%}
      {{ og_text(og_get(v_labels, ['figures'])) }}
    {%- endset -%}
    {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_4}, with_context = false) }}
    {%- for v_s in og_l(og_get(v_extras, ['stats'])) %}
      {%- set v_i = loop.index0 -%}
      {%- if og_t(og_lt(v_i, 3)) %}
        {%- set c_7 -%}
          {%- set c_5 -%}
            {{ og_text(og_get(v_s, ['label'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_5}, with_context = false) }}
          {%- set c_6 -%}
            {{ og_text(og_get(v_s, ['value'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_6}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'attrs': og_attrs(['data-slot', 'media-stat']), 'children': c_7}, with_context = false) }}
      {%- endif %}
    {%- endfor %}
  {%- endset -%}
  {{ include('compose/Stack.html.twig', {'gap': '2', 'align': 'stretch', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'children': c_8}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'stretch', 'attrs': og_attrs(['data-slot', 'media-contacts']), 'children': c_9}, 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 media-contacts
blocks/media-contacts.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/media-contacts.json
    The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card.
    Props (p): extras, labels. *}
{var $v_extras = ($p['extras'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{capture $c_9}
  {capture $c_3}
    {capture $c_1}
      {=og_text(og_get($v_labels, ['list']))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
    {foreach og_l(og_get($v_extras, ['channels'])) as $v_c}
      {var $v_i = $iterator->counter0}
      {capture $c_2}
        {=og_include('icons/LucideIcon.latte', ['name' => og_s(og_get($v_c, ['icon'])), 'size' => 16])|noescape}
        {=og_text(og_get($v_c, ['title']))}
      {/capture}
      {=og_include('compose/Button.latte', ['variant' => 'outline', 'size' => 'default', 'href' => og_url(og_s(og_get($v_c, ['href']))), 'class' => 'w-full gap-2', 'children' => (string) $c_2])|noescape}
    {/foreach}
  {/capture}
  {=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'children' => (string) $c_3])|noescape}
  {capture $c_8}
    {capture $c_4}
      {=og_text(og_get($v_labels, ['figures']))}
    {/capture}
    {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_4])|noescape}
    {foreach og_l(og_get($v_extras, ['stats'])) as $v_s}
      {var $v_i = $iterator->counter0}
      {if og_t(og_lt($v_i, 3))}
        {capture $c_7}
          {capture $c_5}
            {=og_text(og_get($v_s, ['label']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_5])|noescape}
          {capture $c_6}
            {=og_text(og_get($v_s, ['value']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_6])|noescape}
        {/capture}
        {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'attrs' => og_attrs(['data-slot', 'media-stat']), 'children' => (string) $c_7])|noescape}
      {/if}
    {/foreach}
  {/capture}
  {=og_include('compose/Stack.latte', ['gap' => '2', 'align' => 'stretch', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'children' => (string) $c_8])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'stretch', 'attrs' => og_attrs(['data-slot', 'media-contacts']), 'children' => (string) $c_9])|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 media-contacts
blocks/media-contacts.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/media-contacts.json
    The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card.
    Props (p): extras, labels. -#}
{%- set v_extras = og_def(p['extras'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set c_9 -%}
  {%- set c_3 -%}
    {%- set c_1 -%}
      {{ og_text(og_get(v_labels, ['list'])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
    {%- for v_c in og_l(og_get(v_extras, ['channels'])) %}
      {%- set v_i = loop.index0 -%}
      {%- set c_2 -%}
        {{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': og_s(og_get(v_c, ['icon'])), 'Size': 16}}) }}
        {{ og_text(og_get(v_c, ['title'])) }}
      {%- endset -%}
      {{ og_include('compose/button.html.j2', {'p': {'Variant': 'outline', 'Size': 'default', 'Href': og_url(og_s(og_get(v_c, ['href']))), 'Class': 'w-full gap-2'}, 'children': c_2}) }}
    {%- endfor %}
  {%- endset -%}
  {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch'}, 'children': c_3}) }}
  {%- set c_8 -%}
    {%- set c_4 -%}
      {{ og_text(og_get(v_labels, ['figures'])) }}
    {%- endset -%}
    {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_4}) }}
    {%- for v_s in og_l(og_get(v_extras, ['stats'])) %}
      {%- set v_i = loop.index0 -%}
      {%- if og_t(og_lt(v_i, 3)) %}
        {%- set c_7 -%}
          {%- set c_5 -%}
            {{ og_text(og_get(v_s, ['label'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_5}) }}
          {%- set c_6 -%}
            {{ og_text(og_get(v_s, ['value'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_6}) }}
        {%- endset -%}
        {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between', 'Attrs': og_attrs(['data-slot', 'media-stat'])}, 'children': c_7}) }}
      {%- endif %}
    {%- endfor %}
  {%- endset -%}
  {{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Align': 'stretch', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4'}, 'children': c_8}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'stretch', 'Attrs': og_attrs(['data-slot', 'media-contacts'])}, 'children': c_9}) }}

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.

The ways to get help of MediaList as wide outline buttons, then three support figures as rows in a card.

Props of MediaContacts
PropTypeDefault Description
extras (required)MediaExtras-
labels (required)MediaListLabels-

Used in