V2 Container
The Components V2 block that groups text, separators and action rows behind one accent bar.
The Components V2 block that groups text, separators and action rows behind one accent bar. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.
newt-v2-containerimport { ActionRow } from "@/registry/bases/newt/ui/action-row"
import { Button } from "@/registry/bases/newt/ui/button"
import { Divider } from "@/registry/bases/newt/ui/divider"
import { TextDisplay } from "@/registry/bases/newt/ui/text-display"
import { V2Container } from "@/registry/bases/newt/ui/v2-container"
export default function V2ContainerDemo() {
return (
<V2Container accentColor="var(--newt-brand)">
<TextDisplay size="heading-3">Server rules</TextDisplay>
<Divider spacing="small" />
<TextDisplay>
Be kind, keep it on topic, and read the pinned messages before asking.
</TextDisplay>
<ActionRow aria-label="Rules actions">
<Button variant="primary" size="message">
I agree
</Button>
<Button variant="link" size="message">
Read more
</Button>
</ActionRow>
</V2Container>
)
}<script setup lang="ts">
import { ActionRow } from "~~/registry/bases/newt/ui/action-row"
import { Button } from "~~/registry/bases/newt/ui/button"
import { Divider } from "~~/registry/bases/newt/ui/divider"
import { TextDisplay } from "~~/registry/bases/newt/ui/text-display"
import { V2Container } from "~~/registry/bases/newt/ui/v2-container"
</script>
<template>
<V2Container accent-color="var(--newt-brand)">
<TextDisplay size="heading-3">Server rules</TextDisplay>
<Divider spacing="small" />
<TextDisplay>
Be kind, keep it on topic, and read the pinned messages before asking.
</TextDisplay>
<ActionRow aria-label="Rules actions">
<Button variant="primary" size="message">I agree</Button>
<Button variant="link" size="message">Read more</Button>
</ActionRow>
</V2Container>
</template>Build the content from the other message parts: TextDisplay for text, Divider with spacing="small" or spacing="large" for a separator, Section and MediaGallery for media, and ActionRow with Button size="message" for actions.
Installation
npx newtui@latest add v2-containernpx shadcn@latest add @newtui/v2-containernpx shadcn-vue@latest add @newtui/v2-containerpnpm dlx newtui@latest add v2-containerpnpm dlx shadcn@latest add @newtui/v2-containerpnpm dlx shadcn-vue@latest add @newtui/v2-containeryarn dlx newtui@latest add v2-containeryarn dlx shadcn@latest add @newtui/v2-containeryarn dlx shadcn-vue@latest add @newtui/v2-containerbunx newtui@latest add v2-containerbunx shadcn@latest add @newtui/v2-containerbunx shadcn-vue@latest add @newtui/v2-containerdeno run -A npm:newtui@latest add v2-containerdeno run -A npm:shadcn@latest add @newtui/v2-containerdeno run -A npm:shadcn-vue@latest add @newtui/v2-containervlx newtui@latest add v2-containervlx shadcn@latest add @newtui/v2-containervlx shadcn-vue@latest add @newtui/v2-containervp dlx newtui@latest add v2-containervp dlx shadcn@latest add @newtui/v2-containervp dlx shadcn-vue@latest add @newtui/v2-containernubx newtui@latest add v2-containernubx shadcn@latest add @newtui/v2-containernubx shadcn-vue@latest add @newtui/v2-containernlx newtui@latest add v2-containernlx shadcn@latest add @newtui/v2-containernlx shadcn-vue@latest add @newtui/v2-containerupx newtui@latest add v2-containerupx shadcn@latest add @newtui/v2-containerupx shadcn-vue@latest add @newtui/v2-container- 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 V2ContainerProps extends React.ComponentProps<"div"> {
/** Accent colour of the left bar; defaults to the surface border. */
accentColor?: string
}
/*
* The Components V2 container: an accent-barred block that groups text,
* separators and action rows inside a single message.
*/
const V2Container = React.forwardRef<HTMLDivElement, V2ContainerProps>(
({ className, accentColor, style, ...props }, ref) => (
<div
ref={ref}
className={cn(
"mt-1 flex max-w-[520px] flex-col gap-2 rounded-[var(--newt-radius-sm)] border-s-4 border-[var(--newt-v2-accent)] bg-newt-bg-surface p-3 text-sm leading-relaxed text-newt-text-primary",
className
)}
/*
* 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={
{
...style,
"--newt-v2-accent": accentColor ?? "var(--newt-border)",
} as React.CSSProperties
}
{...props}
/>
)
)
V2Container.displayName = "V2Container"
export { V2Container }<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; defaults to the surface border. */
accentColor?: string
}>()
const style = computed(
() =>
// SAFETY: Vue forwards unknown `--*` keys to the DOM verbatim, so a custom
// property is a valid style entry even though the type omits it.
({
"--newt-v2-accent": props.accentColor ?? "var(--newt-border)",
}) as CSSProperties
)
</script>
<template>
<!--
The Components V2 container: an accent-barred block that groups text,
separators and action rows inside a single message.
-->
<div
:style="style"
:class="
cn(
'mt-1 flex max-w-[520px] flex-col gap-2 rounded-[var(--newt-radius-sm)] border-s-4 border-[var(--newt-v2-accent)] bg-newt-bg-surface p-3 text-sm leading-relaxed text-newt-text-primary',
props.class
)
"
>
<slot />
</div>
</template>export { default as V2Container } from "./V2Container.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 V2 Container 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 V2 Container 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 { V2Container } from "@/components/ui/v2-container"
export function Example() {
return <V2Container />
}<script setup lang="ts">
import { V2Container } from "@/components/ui/v2-container"
</script>
<template>
<V2Container />
</template>API reference
V2Container
accentColor?string | undefined
Accent colour of the left bar. Without one, the bar takes `--newt-border`, the same default as `Embed`.
string | undefinedThe registry exports V2Container. 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.
Tokens
V2 Container 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-v2-container.
--newt-border--newt-radius-sm--newt-bg-surface--newt-text-primary