Embed
A Discord-inspired rich message embed with an accent bar, author, title, description, fields, footer and timestamp.
A Discord-inspired rich message embed with an accent bar, author, title, description, fields, footer and timestamp. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.
newt-embedimport {
Embed,
EmbedAuthor,
EmbedAuthorIcon,
EmbedAuthorName,
EmbedDescription,
EmbedEyebrow,
EmbedField,
EmbedFieldName,
EmbedFieldValue,
EmbedFields,
EmbedFooter,
EmbedFooterIcon,
EmbedFooterSeparator,
EmbedTimestamp,
EmbedTitle,
} from "@/registry/bases/newt/ui/embed"
/* Inline so the demo never reaches out to the network for a placeholder. */
const ICON =
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12' fill='%2323a55a'/%3E%3C/svg%3E"
export default function EmbedDemo() {
return (
<Embed color="#23a55a">
<EmbedAuthor>
<EmbedAuthorIcon src={ICON} />
<EmbedAuthorName>Author name</EmbedAuthorName>
</EmbedAuthor>
<EmbedEyebrow>Source · category</EmbedEyebrow>
<EmbedTitle>Embed title</EmbedTitle>
<EmbedDescription>Embed description text goes here.</EmbedDescription>
<EmbedFields>
<EmbedField>
<EmbedFieldName>Field</EmbedFieldName>
<EmbedFieldValue>Value</EmbedFieldValue>
</EmbedField>
</EmbedFields>
<EmbedFooter>
<EmbedFooterIcon src={ICON} />
<span>
Footer text
<EmbedFooterSeparator />
<EmbedTimestamp date="2026-09-04T12:00:00.000Z" />
</span>
</EmbedFooter>
</Embed>
)
}<script setup lang="ts">
import {
Embed,
EmbedAuthor,
EmbedAuthorIcon,
EmbedAuthorName,
EmbedDescription,
EmbedEyebrow,
EmbedField,
EmbedFieldName,
EmbedFieldValue,
EmbedFields,
EmbedFooter,
EmbedFooterIcon,
EmbedFooterSeparator,
EmbedTimestamp,
EmbedTitle,
} from "~~/registry/bases/newt/ui/embed"
/* Inline so the demo never reaches out to the network for a placeholder. */
const ICON =
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='12' fill='%2323a55a'/%3E%3C/svg%3E"
</script>
<template>
<Embed color="#23a55a">
<EmbedAuthor>
<EmbedAuthorIcon :src="ICON" />
<EmbedAuthorName>Author name</EmbedAuthorName>
</EmbedAuthor>
<EmbedEyebrow>Source · category</EmbedEyebrow>
<EmbedTitle>Embed title</EmbedTitle>
<EmbedDescription>Embed description text goes here.</EmbedDescription>
<EmbedFields>
<EmbedField>
<EmbedFieldName>Field</EmbedFieldName>
<EmbedFieldValue>Value</EmbedFieldValue>
</EmbedField>
</EmbedFields>
<EmbedFooter>
<EmbedFooterIcon :src="ICON" />
<span>
Footer text
<EmbedFooterSeparator />
<EmbedTimestamp date="2026-09-04T12:00:00.000Z" />
</span>
</EmbedFooter>
</Embed>
</template>Installation
npx newtui@latest add embednpx shadcn@latest add @newtui/embednpx shadcn-vue@latest add @newtui/embedpnpm dlx newtui@latest add embedpnpm dlx shadcn@latest add @newtui/embedpnpm dlx shadcn-vue@latest add @newtui/embedyarn dlx newtui@latest add embedyarn dlx shadcn@latest add @newtui/embedyarn dlx shadcn-vue@latest add @newtui/embedbunx newtui@latest add embedbunx shadcn@latest add @newtui/embedbunx shadcn-vue@latest add @newtui/embeddeno run -A npm:newtui@latest add embeddeno run -A npm:shadcn@latest add @newtui/embeddeno run -A npm:shadcn-vue@latest add @newtui/embedvlx newtui@latest add embedvlx shadcn@latest add @newtui/embedvlx shadcn-vue@latest add @newtui/embedvp dlx newtui@latest add embedvp dlx shadcn@latest add @newtui/embedvp dlx shadcn-vue@latest add @newtui/embednubx newtui@latest add embednubx shadcn@latest add @newtui/embednubx shadcn-vue@latest add @newtui/embednlx newtui@latest add embednlx shadcn@latest add @newtui/embednlx shadcn-vue@latest add @newtui/embedupx newtui@latest add embedupx shadcn@latest add @newtui/embedupx shadcn-vue@latest add @newtui/embed- newtui
- shadcn
- npm
- pnpm
- yarn
- bun
- deno
- vlt
- vp
- nub
- ni
- upm
The shadcn CLI needs the @newtui registry in your components.json. Set it up.
Copy the source into your project
import * as React from "react"
import { cn } from "@/lib/utils"
export interface EmbedProps extends Omit<React.ComponentProps<"div">, "color"> {
/** Accent colour of the left bar. Any CSS colour; defaults to the border colour, like `V2Container`. */
color?: string
}
const Embed = React.forwardRef<HTMLDivElement, EmbedProps>(
({ className, children, color, style, ...props }, ref) => (
<div
ref={ref}
/*
* SAFETY: `CSSProperties` has no index signature for custom properties,
* but React forwards unknown `--*` keys to the style attribute verbatim,
* so the extra key is written out exactly as spelled here.
*/
style={
color
? ({ ...style, "--newt-embed-color": color } as React.CSSProperties)
: style
}
className={cn(
"relative flex max-w-[var(--newt-embed-max-width)] overflow-hidden rounded-[var(--newt-radius-md)] border border-s-0 border-newt-embed-border bg-newt-embed-bg before:absolute before:inset-y-0 before:start-0 before:w-1 before:bg-[var(--newt-embed-color,var(--newt-border))]",
className
)}
{...props}
>
<div className="flex min-w-0 flex-1 flex-col gap-2 py-3 ps-5 pe-4">
{children}
</div>
</div>
)
)
Embed.displayName = "Embed"
const EmbedAuthor = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"flex min-w-0 items-center gap-2 text-[14px] font-semibold text-newt-text-primary",
className
)}
{...props}
/>
))
EmbedAuthor.displayName = "EmbedAuthor"
/*
* The props of the element or component `as` names, so a custom image
* component's own props type-check.
*/
export type EmbedIconProps<E extends React.ElementType = "img"> = {
/**
* The image element or component to render. Defaults to `img`; pass your
* framework's image component for optimised sources.
*/
as?: E
} & Omit<React.ComponentPropsWithRef<E>, "as">
type EmbedIconComponent = {
<E extends React.ElementType = "img">(
props: EmbedIconProps<E>
): React.ReactNode
displayName?: string
}
/*
* SAFETY: `forwardRef` drops the generic signature. The render hands every
* prop it does not set itself to `as` unchanged, so the props of `as` are
* the props the part receives.
*/
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see SAFETY
const EmbedAuthorIcon = React.forwardRef<HTMLImageElement, EmbedIconProps>(
({ as: Tag = "img", className, alt = "", ...props }, ref) => (
<Tag
ref={ref}
alt={alt}
aria-hidden={alt === "" ? true : undefined}
className={cn("h-6 w-6 shrink-0 rounded-full object-cover", className)}
{...props}
/>
)
) as EmbedIconComponent
EmbedAuthorIcon.displayName = "EmbedAuthorIcon"
const EmbedAuthorName = React.forwardRef<
HTMLSpanElement,
React.ComponentProps<"span">
>(({ className, ...props }, ref) => (
<span ref={ref} className={cn("truncate", className)} {...props} />
))
EmbedAuthorName.displayName = "EmbedAuthorName"
const EmbedEyebrow = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"text-[12px] font-semibold text-newt-text-secondary",
className
)}
{...props}
/>
))
EmbedEyebrow.displayName = "EmbedEyebrow"
const EmbedTitle = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-[16px] font-semibold text-newt-text-link", className)}
{...props}
/>
))
EmbedTitle.displayName = "EmbedTitle"
const EmbedDescription = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"text-[14px] leading-[20px] text-newt-text-secondary",
className
)}
{...props}
/>
))
EmbedDescription.displayName = "EmbedDescription"
const EmbedFields = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"mt-1 grid grid-cols-[repeat(auto-fit,minmax(120px,1fr))] gap-2",
className
)}
{...props}
/>
))
EmbedFields.displayName = "EmbedFields"
const EmbedField = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn(className)} {...props} />
))
EmbedField.displayName = "EmbedField"
const EmbedFieldName = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"mb-0.5 text-[13px] font-semibold text-newt-text-primary",
className
)}
{...props}
/>
))
EmbedFieldName.displayName = "EmbedFieldName"
const EmbedFieldValue = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("text-[13px] text-newt-text-secondary", className)}
{...props}
/>
))
EmbedFieldValue.displayName = "EmbedFieldValue"
const EmbedFooter = React.forwardRef<
HTMLDivElement,
React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
"mt-1 flex min-w-0 items-center gap-2 text-[12px] text-newt-text-muted",
className
)}
{...props}
/>
))
EmbedFooter.displayName = "EmbedFooter"
/*
* SAFETY: `forwardRef` drops the generic signature. The render hands every
* prop it does not set itself to `as` unchanged, so the props of `as` are
* the props the part receives.
*/
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- see SAFETY
const EmbedFooterIcon = React.forwardRef<HTMLImageElement, EmbedIconProps>(
({ as: Tag = "img", className, alt = "", ...props }, ref) => (
<Tag
ref={ref}
alt={alt}
aria-hidden={alt === "" ? true : undefined}
className={cn("h-4 w-4 shrink-0 rounded-full object-cover", className)}
{...props}
/>
)
) as EmbedIconComponent
EmbedFooterIcon.displayName = "EmbedFooterIcon"
/* Middle dot, the way Discord separates footer text from the timestamp. */
const EmbedFooterSeparator = React.forwardRef<
HTMLSpanElement,
React.ComponentProps<"span">
>(({ className, children = "\u2022", ...props }, ref) => (
<span
ref={ref}
aria-hidden="true"
className={cn("mx-1", className)}
{...props}
>
{children}
</span>
))
EmbedFooterSeparator.displayName = "EmbedFooterSeparator"
/*
* A fixed locale, not the visitor's: an embed rendered on the server and
* hydrated in the browser has to produce the same string in both places.
* One formatter per locale and zone, built on first use.
*/
const embedTimeFormats = new Map<string, Intl.DateTimeFormat>()
function embedTimeFormat(locale: string, timeZone: string | undefined) {
const key = `${locale}|${timeZone ?? ""}`
let format = embedTimeFormats.get(key)
if (!format) {
format = new Intl.DateTimeFormat(locale, {
dateStyle: "short",
timeStyle: "short",
timeZone,
})
embedTimeFormats.set(key, format)
}
return format
}
export interface EmbedTimestampProps extends Omit<
React.ComponentProps<"time">,
"dateTime"
> {
/** The moment to render. Anything `new Date()` accepts. */
date: Date | number | string
/**
* Locale of the text. Pass a fixed value, not the browser's language, so
* the server and the browser write the same text.
*/
locale?: string
/**
* Time zone of the text, such as `"Europe/Paris"`. Defaults to the zone of
* the runtime. Set it when the server and the browser sit in other zones.
*/
timeZone?: string
/** Builds the text from the date. Wins over `locale` and `timeZone`. */
formatter?: (date: Date) => string
}
const EmbedTimestamp = React.forwardRef<HTMLTimeElement, EmbedTimestampProps>(
(
{
className,
date,
locale = "en-US",
timeZone,
formatter,
children,
...props
},
ref
) => {
const value = date instanceof Date ? date : new Date(date)
const valid = !Number.isNaN(value.getTime())
const text = valid
? (formatter?.(value) ?? embedTimeFormat(locale, timeZone).format(value))
: ""
return (
<time
ref={ref}
dateTime={valid ? value.toISOString() : undefined}
className={cn(className)}
{...props}
>
{children ?? text}
</time>
)
}
)
EmbedTimestamp.displayName = "EmbedTimestamp"
export {
Embed,
EmbedAuthor,
EmbedAuthorIcon,
EmbedAuthorName,
EmbedEyebrow,
EmbedTitle,
EmbedDescription,
EmbedFields,
EmbedField,
EmbedFieldName,
EmbedFieldValue,
EmbedFooter,
EmbedFooterIcon,
EmbedFooterSeparator,
EmbedTimestamp,
}<script setup lang="ts">
import type { CSSProperties, HTMLAttributes } from "vue"
import { computed } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{
class?: HTMLAttributes["class"]
/** Accent colour of the left bar. Any CSS colour; defaults to the border colour, like `V2Container`. */
color?: string
}>()
/*
* SAFETY: `CSSProperties` has no index signature for custom properties, but
* Vue writes unknown `--*` keys to the style attribute verbatim, so the extra
* key lands exactly as spelled here.
*/
const style = computed<CSSProperties | undefined>(() =>
props.color
? ({ "--newt-embed-color": props.color } as CSSProperties)
: undefined
)
</script>
<template>
<div
:style="style"
:class="
cn(
'relative flex max-w-[var(--newt-embed-max-width)] overflow-hidden rounded-[var(--newt-radius-md)] border border-s-0 border-newt-embed-border bg-newt-embed-bg before:absolute before:inset-y-0 before:start-0 before:w-1 before:bg-[var(--newt-embed-color,var(--newt-border))]',
props.class
)
"
>
<div class="flex min-w-0 flex-1 flex-col gap-2 py-3 ps-5 pe-4">
<slot />
</div>
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn(
'flex min-w-0 items-center gap-2 text-[14px] font-semibold text-newt-text-primary',
props.class
)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { Component, HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = withDefaults(
defineProps<{
class?: HTMLAttributes["class"]
/**
* The image element or component to render. Defaults to `img`; pass
* `NuxtImg` or another image component for optimised sources.
*/
as?: string | Component
src: string
alt?: string
}>(),
{ as: "img", alt: "" }
)
</script>
<template>
<component
:is="props.as"
:src="props.src"
:alt="props.alt"
:aria-hidden="props.alt === '' ? true : undefined"
:class="cn('h-6 w-6 shrink-0 rounded-full object-cover', props.class)"
/>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<span :class="cn('truncate', props.class)"><slot /></span>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn('text-[12px] font-semibold text-newt-text-secondary', props.class)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="cn('text-[16px] font-semibold text-newt-text-link', props.class)"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn('text-[14px] leading-[20px] text-newt-text-secondary', props.class)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn(
'mt-1 grid grid-cols-[repeat(auto-fit,minmax(120px,1fr))] gap-2',
props.class
)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div :class="cn('', props.class)">
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn('mb-0.5 text-[13px] font-semibold text-newt-text-primary', props.class)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div :class="cn('text-[13px] text-newt-text-secondary', props.class)">
<slot />
</div>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<template>
<div
:class="
cn(
'mt-1 flex min-w-0 items-center gap-2 text-[12px] text-newt-text-muted',
props.class
)
"
>
<slot />
</div>
</template><script setup lang="ts">
import type { Component, HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = withDefaults(
defineProps<{
class?: HTMLAttributes["class"]
/**
* The image element or component to render. Defaults to `img`; pass
* `NuxtImg` or another image component for optimised sources.
*/
as?: string | Component
src: string
alt?: string
}>(),
{ as: "img", alt: "" }
)
</script>
<template>
<component
:is="props.as"
:src="props.src"
:alt="props.alt"
:aria-hidden="props.alt === '' ? true : undefined"
:class="cn('h-4 w-4 shrink-0 rounded-full object-cover', props.class)"
/>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { cn } from "@/lib/utils"
const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>
<!-- Middle dot, the way Discord separates footer text from the timestamp. -->
<template>
<span aria-hidden="true" :class="cn('mx-1', props.class)">
<slot>•</slot>
</span>
</template><script setup lang="ts">
import type { HTMLAttributes } from "vue"
import { computed } from "vue"
import { cn } from "@/lib/utils"
const props = withDefaults(
defineProps<{
class?: HTMLAttributes["class"]
/** The moment to render. Anything `new Date()` accepts. */
date: Date | number | string
/**
* Locale of the text. Pass a fixed value, not the browser's language, so
* the server and the browser write the same text.
*/
locale?: string
/**
* Time zone of the text, such as `"Europe/Paris"`. Defaults to the zone of
* the runtime. Set it when the server and the browser sit in other zones.
*/
timeZone?: string
/** Builds the text from the date. Wins over `locale` and `timeZone`. */
formatter?: (date: Date) => string
}>(),
{ locale: "en-US" }
)
/*
* A fixed locale, not the visitor's: an embed rendered on the server and
* hydrated in the browser has to produce the same string in both places.
*/
const format = computed(
() =>
new Intl.DateTimeFormat(props.locale, {
dateStyle: "short",
timeStyle: "short",
timeZone: props.timeZone,
})
)
const value = computed(() =>
props.date instanceof Date ? props.date : new Date(props.date)
)
const valid = computed(() => !Number.isNaN(value.value.getTime()))
const text = computed(() => {
if (!valid.value) return ""
return props.formatter?.(value.value) ?? format.value.format(value.value)
})
</script>
<template>
<time
:datetime="valid ? value.toISOString() : undefined"
:class="cn(props.class)"
>
<slot>{{ text }}</slot>
</time>
</template>export { default as Embed } from "./Embed.vue"
export { default as EmbedAuthor } from "./EmbedAuthor.vue"
export { default as EmbedAuthorIcon } from "./EmbedAuthorIcon.vue"
export { default as EmbedAuthorName } from "./EmbedAuthorName.vue"
export { default as EmbedEyebrow } from "./EmbedEyebrow.vue"
export { default as EmbedTitle } from "./EmbedTitle.vue"
export { default as EmbedDescription } from "./EmbedDescription.vue"
export { default as EmbedFields } from "./EmbedFields.vue"
export { default as EmbedField } from "./EmbedField.vue"
export { default as EmbedFieldName } from "./EmbedFieldName.vue"
export { default as EmbedFieldValue } from "./EmbedFieldValue.vue"
export { default as EmbedFooter } from "./EmbedFooter.vue"
export { default as EmbedFooterIcon } from "./EmbedFooterIcon.vue"
export { default as EmbedFooterSeparator } from "./EmbedFooterSeparator.vue"
export { default as EmbedTimestamp } from "./EmbedTimestamp.vue"Update the import paths
The files import @/lib/utils and sibling components through the aliases in your components.json. Point them at wherever those live in your project.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Embed to your React project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Embed to your Vue project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.
Usage
import { Embed } from "@/components/ui/embed"
export function Example() {
return <Embed />
}<script setup lang="ts">
import { Embed, EmbedAuthor, EmbedAuthorIcon, EmbedAuthorName, EmbedEyebrow, EmbedTitle, EmbedDescription, EmbedFields, EmbedField, EmbedFieldName, EmbedFieldValue, EmbedFooter, EmbedFooterIcon, EmbedFooterSeparator, EmbedTimestamp } from "@/components/ui/embed"
</script>
<template>
<Embed />
</template>Examples
Accent colors
The color prop sets the bar on the leading edge. It takes any CSS colour, so passing a --newt-* token lets an embed signal success, a warning or a failure and still follow the theme.
newt-embedimport {
Embed,
EmbedDescription,
EmbedTitle,
} from "@/registry/bases/newt/ui/embed"
/* `color` takes any CSS colour, so a token keeps the bar on the theme. */
const NOTICES = [
{
color: "var(--newt-online)",
title: "Deploy succeeded",
description: "Build 482 is live on production.",
},
{
color: "var(--newt-idle)",
title: "Deploy is slow",
description: "Build 483 has been queued for ten minutes.",
},
{
color: "var(--newt-danger)",
title: "Deploy failed",
description: "Build 484 stopped at the test step.",
},
]
export default function EmbedColorsDemo() {
return (
<div className="flex w-full max-w-md flex-col gap-2">
{NOTICES.map((notice) => (
<Embed key={notice.title} color={notice.color}>
<EmbedTitle>{notice.title}</EmbedTitle>
<EmbedDescription>{notice.description}</EmbedDescription>
</Embed>
))}
</div>
)
}<script setup lang="ts">
import {
Embed,
EmbedDescription,
EmbedTitle,
} from "~~/registry/bases/newt/ui/embed"
/* `color` takes any CSS colour, so a token keeps the bar on the theme. */
const notices = [
{
color: "var(--newt-online)",
title: "Deploy succeeded",
description: "Build 482 is live on production.",
},
{
color: "var(--newt-idle)",
title: "Deploy is slow",
description: "Build 483 has been queued for ten minutes.",
},
{
color: "var(--newt-danger)",
title: "Deploy failed",
description: "Build 484 stopped at the test step.",
},
]
</script>
<template>
<div class="flex w-full max-w-md flex-col gap-2">
<Embed v-for="notice in notices" :key="notice.title" :color="notice.color">
<EmbedTitle>{{ notice.title }}</EmbedTitle>
<EmbedDescription>{{ notice.description }}</EmbedDescription>
</Embed>
</div>
</template>Fields
EmbedFields lays its EmbedField children out in a grid that fits as many columns as the width allows. Use it for short name and value pairs, such as stats or settings.
newt-embedimport {
Embed,
EmbedField,
EmbedFieldName,
EmbedFieldValue,
EmbedFields,
EmbedFooter,
EmbedTimestamp,
EmbedTitle,
} from "@/registry/bases/newt/ui/embed"
const STATS = [
{ name: "Members", value: "1,204" },
{ name: "Online", value: "312" },
{ name: "Channels", value: "28" },
{ name: "Roles", value: "16" },
{ name: "Created", value: "March 2024" },
{ name: "Region", value: "Europe" },
]
/* The grid fits as many columns as the width allows and wraps the rest. */
export default function EmbedFieldsDemo() {
return (
<Embed>
<EmbedTitle>Server overview</EmbedTitle>
<EmbedFields>
{STATS.map((stat) => (
<EmbedField key={stat.name}>
<EmbedFieldName>{stat.name}</EmbedFieldName>
<EmbedFieldValue>{stat.value}</EmbedFieldValue>
</EmbedField>
))}
</EmbedFields>
<EmbedFooter>
<EmbedTimestamp date="2026-09-04T12:00:00.000Z" />
</EmbedFooter>
</Embed>
)
}<script setup lang="ts">
import {
Embed,
EmbedField,
EmbedFieldName,
EmbedFieldValue,
EmbedFields,
EmbedFooter,
EmbedTimestamp,
EmbedTitle,
} from "~~/registry/bases/newt/ui/embed"
/* The grid fits as many columns as the width allows and wraps the rest. */
const stats = [
{ name: "Members", value: "1,204" },
{ name: "Online", value: "312" },
{ name: "Channels", value: "28" },
{ name: "Roles", value: "16" },
{ name: "Created", value: "March 2024" },
{ name: "Region", value: "Europe" },
]
</script>
<template>
<Embed>
<EmbedTitle>Server overview</EmbedTitle>
<EmbedFields>
<EmbedField v-for="stat in stats" :key="stat.name">
<EmbedFieldName>{{ stat.name }}</EmbedFieldName>
<EmbedFieldValue>{{ stat.value }}</EmbedFieldValue>
</EmbedField>
</EmbedFields>
<EmbedFooter>
<EmbedTimestamp date="2026-09-04T12:00:00.000Z" />
</EmbedFooter>
</Embed>
</template>Minimal
Every part of an embed is optional. A lone EmbedDescription is enough for a short confirmation, and with no color the bar takes the neutral border colour.
newt-embedimport { Embed, EmbedDescription } from "@/registry/bases/newt/ui/embed"
/* Every part is optional: with no `color` the bar takes the neutral border colour. */
export default function EmbedMinimalDemo() {
return (
<Embed>
<EmbedDescription>
Your nickname on this server is now <strong>Rowan</strong>.
</EmbedDescription>
</Embed>
)
}<script setup lang="ts">
import { Embed, EmbedDescription } from "~~/registry/bases/newt/ui/embed"
/* Every part is optional: with no `color` the bar takes the neutral border colour. */
</script>
<template>
<Embed>
<EmbedDescription>
Your nickname on this server is now <strong>Rowan</strong>.
</EmbedDescription>
</Embed>
</template>API reference
Embed
color?string | undefined
Accent colour of the left bar. Any CSS colour. Without one, the bar takes `--newt-border`, the same default as `V2Container`.
string | undefinedEmbedAuthorIcon / EmbedFooterIcon
as?React.ElementType (React) / string | Component (Vue)
The image element or component to render. Pass your framework's image component, such as `NuxtImg`, for optimised sources.
React.ElementType (React) / string | Component (Vue)"img"EmbedTimestamp
date?Date | number | string
The moment to render. Anything `new Date()` accepts.
Date | number | stringlocale?string
Locale of the text. Pass a fixed value, so the server and the browser write the same text.
string"en-US"timeZone?string | undefined
Time zone of the text, such as `Europe/Paris`. Defaults to the zone of the runtime.
string | undefinedformatter?(date: Date) => string | undefined
Builds the text from the date. Wins over `locale` and `timeZone`.
(date: Date) => string | undefinedThe registry exports Embed, EmbedAuthor, EmbedAuthorIcon, EmbedAuthorName, EmbedEyebrow, EmbedTitle, EmbedDescription, EmbedFields, EmbedField, EmbedFieldName, EmbedFieldValue, EmbedFooter, EmbedFooterIcon, EmbedFooterSeparator, EmbedTimestamp. Parts without a table accept the native attributes for the element they render; React uses className, while Vue uses class and fallthrough attributes.
Accessibility
Preserve the native semantics of the rendered elements and pass through ARIA attributes when the surrounding context needs a label or description. Any interactive child needs a visible focus indicator, and meaning must not rely on colour alone.
EmbedTimestamp writes an en-US date unless you pass locale or formatter. Translating labels lists every English default.
Tokens
Embed reads its colours, radii and motion from the --newt-* tokens installed with the library. Override a token and every component that reads it follows, including this one — see the token layer. In the plain HTML and CSS distribution the same component is newt-embed.
--newt-border--newt-embed-max-width--newt-embed-border--newt-radius-md--newt-embed-bg--newt-text-primary--newt-radius-full--newt-text-secondary--newt-text-link--newt-text-muted