Skip to content

ComponentsMessaging

SourceSource

App Invite

The app directory card a link to an app unfurls into inside a message: cover banner, icon, name and a call to action.

The card a link to an app’s directory page unfurls into inside a message: the app’s cover art across the top, its icon and name, an optional one-line pitch and a full-width call to action. Where Invite points at a server to join, App Invite points at an app to learn about or add.

Root class newt-app-invite
import {
  AppInvite,
  AppInviteBanner,
  AppInviteBody,
  AppInviteDescription,
  AppInviteHeader,
  AppInviteIcon,
  AppInviteInfo,
  AppInviteName,
} from "@/registry/bases/newt/ui/app-invite"
import { Button } from "@/registry/bases/newt/ui/button"

/* Inline so the demo never reaches out to the network for a placeholder. */
const APP_BANNER =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 432 144'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%235865f2'/%3E%3Cstop offset='1' stop-color='%2323a55a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='432' height='144' fill='url(%23g)'/%3E%3C/svg%3E"
const APP_ICON =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect width='80' height='80' rx='16' fill='%2323a55a'/%3E%3Ccircle cx='40' cy='40' r='18' fill='%23ffffff' fill-opacity='.85'/%3E%3C/svg%3E"

export default function AppInviteDemo() {
  return (
    <AppInvite aria-labelledby="app-invite-demo-name">
      <AppInviteBanner src={APP_BANNER} />
      <AppInviteBody>
        <AppInviteHeader>
          <AppInviteIcon src={APP_ICON} />
          <AppInviteInfo>
            <AppInviteName id="app-invite-demo-name" href="#">
              Newt Helper
            </AppInviteName>
            <AppInviteDescription>
              Moderation, reminders and slash commands for your server.
            </AppInviteDescription>
          </AppInviteInfo>
        </AppInviteHeader>
        <Button variant="secondary" href="#" className="w-full">
          Learn More
        </Button>
      </AppInviteBody>
    </AppInvite>
  )
}
<script setup lang="ts">
import {
  AppInvite,
  AppInviteBanner,
  AppInviteBody,
  AppInviteDescription,
  AppInviteHeader,
  AppInviteIcon,
  AppInviteInfo,
  AppInviteName,
} from "~~/registry/bases/newt/ui/app-invite"
import { Button } from "~~/registry/bases/newt/ui/button"

/* Inline so the demo never reaches out to the network for a placeholder. */
const APP_BANNER =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 432 144'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%235865f2'/%3E%3Cstop offset='1' stop-color='%2323a55a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='432' height='144' fill='url(%23g)'/%3E%3C/svg%3E"
const APP_ICON =
  "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Crect width='80' height='80' rx='16' fill='%2323a55a'/%3E%3Ccircle cx='40' cy='40' r='18' fill='%23ffffff' fill-opacity='.85'/%3E%3C/svg%3E"
</script>

<template>
  <AppInvite aria-labelledby="app-invite-demo-name">
    <AppInviteBanner :src="APP_BANNER" />
    <AppInviteBody>
      <AppInviteHeader>
        <AppInviteIcon :src="APP_ICON" />
        <AppInviteInfo>
          <AppInviteName id="app-invite-demo-name" href="#">
            Newt Helper
          </AppInviteName>
          <AppInviteDescription>
            Moderation, reminders and slash commands for your server.
          </AppInviteDescription>
        </AppInviteInfo>
      </AppInviteHeader>
      <Button variant="secondary" href="#" class="w-full">Learn More</Button>
    </AppInviteBody>
  </AppInvite>
</template>

Installation

npx newtui@latest add app-invitenpx shadcn@latest add @newtui/app-invitenpx shadcn-vue@latest add @newtui/app-invitepnpm dlx newtui@latest add app-invitepnpm dlx shadcn@latest add @newtui/app-invitepnpm dlx shadcn-vue@latest add @newtui/app-inviteyarn dlx newtui@latest add app-inviteyarn dlx shadcn@latest add @newtui/app-inviteyarn dlx shadcn-vue@latest add @newtui/app-invitebunx newtui@latest add app-invitebunx shadcn@latest add @newtui/app-invitebunx shadcn-vue@latest add @newtui/app-invitedeno run -A npm:newtui@latest add app-invitedeno run -A npm:shadcn@latest add @newtui/app-invitedeno run -A npm:shadcn-vue@latest add @newtui/app-invitevlx newtui@latest add app-invitevlx shadcn@latest add @newtui/app-invitevlx shadcn-vue@latest add @newtui/app-invitevp dlx newtui@latest add app-invitevp dlx shadcn@latest add @newtui/app-invitevp dlx shadcn-vue@latest add @newtui/app-invitenubx newtui@latest add app-invitenubx shadcn@latest add @newtui/app-invitenubx shadcn-vue@latest add @newtui/app-invitenlx newtui@latest add app-invitenlx shadcn@latest add @newtui/app-invitenlx shadcn-vue@latest add @newtui/app-inviteupx newtui@latest add app-inviteupx shadcn@latest add @newtui/app-inviteupx shadcn-vue@latest add @newtui/app-invite

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

Add the components it builds on

Copy the source into your project

import * as React from "react"

import { cn } from "@/lib/utils"

/* The app directory card a link to an app unfurls into inside a message. */
const AppInvite = React.forwardRef<
  HTMLElement,
  React.HTMLAttributes<HTMLElement>
>(({ className, ...props }, ref) => (
  <article
    ref={ref}
    className={cn(
      "flex max-w-[432px] flex-col overflow-hidden rounded-[var(--newt-radius-lg)] bg-newt-bg-surface text-newt-text-primary",
      className
    )}
    {...props}
  />
))
AppInvite.displayName = "AppInvite"

const AppInviteBanner = React.forwardRef<
  HTMLImageElement,
  React.ComponentProps<"img">
>(({ className, alt = "", ...props }, ref) => (
  <img
    ref={ref}
    alt={alt}
    aria-hidden={alt === "" ? true : undefined}
    className={cn(
      "block aspect-[3/1] w-full bg-newt-bg-base object-cover",
      className
    )}
    {...props}
  />
))
AppInviteBanner.displayName = "AppInviteBanner"

const AppInviteBody = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("flex flex-col gap-4 p-4", className)}
    {...props}
  />
))
AppInviteBody.displayName = "AppInviteBody"

const AppInviteHeader = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("flex items-center gap-4", className)}
    {...props}
  />
))
AppInviteHeader.displayName = "AppInviteHeader"

const AppInviteIcon = React.forwardRef<
  HTMLImageElement,
  React.ComponentProps<"img">
>(({ className, alt = "", ...props }, ref) => (
  <img
    ref={ref}
    alt={alt}
    aria-hidden={alt === "" ? true : undefined}
    className={cn(
      "h-20 w-20 shrink-0 rounded-[var(--newt-radius-lg)] bg-newt-bg-base object-cover",
      className
    )}
    {...props}
  />
))
AppInviteIcon.displayName = "AppInviteIcon"

const AppInviteInfo = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
  <div ref={ref} className={cn("min-w-0 flex-1", className)} {...props} />
))
AppInviteInfo.displayName = "AppInviteInfo"

export interface AppInviteNameProps extends React.HTMLAttributes<HTMLElement> {
  /** Link to the app's page. Without it the name renders as plain text. */
  href?: string
}

const AppInviteName = React.forwardRef<HTMLElement, AppInviteNameProps>(
  ({ className, href, ...props }, ref) =>
    /* A link only when there is somewhere to go; plain text otherwise. */
    React.createElement(href === undefined ? "span" : "a", {
      ref,
      href,
      className: cn(
        "block truncate text-base font-bold text-newt-text-primary no-underline",
        href !== undefined && "hover:underline",
        className
      ),
      ...props,
    })
)
AppInviteName.displayName = "AppInviteName"

const AppInviteDescription = React.forwardRef<
  HTMLParagraphElement,
  React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
  <p
    ref={ref}
    className={cn(
      "mt-1 line-clamp-2 text-sm text-newt-text-secondary",
      className
    )}
    {...props}
  />
))
AppInviteDescription.displayName = "AppInviteDescription"

export {
  AppInvite,
  AppInviteBanner,
  AppInviteBody,
  AppInviteHeader,
  AppInviteIcon,
  AppInviteInfo,
  AppInviteName,
  AppInviteDescription,
}
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <article
    :class="
      cn(
        'flex max-w-[432px] flex-col overflow-hidden rounded-[var(--newt-radius-lg)] bg-newt-bg-surface text-newt-text-primary',
        props.class
      )
    "
  >
    <slot />
  </article>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = withDefaults(
  defineProps<{ class?: HTMLAttributes["class"]; src: string; alt?: string }>(),
  { alt: "" }
)
</script>

<template>
  <img
    :src="props.src"
    :alt="props.alt"
    :aria-hidden="props.alt === '' ? true : undefined"
    :class="
      cn('block aspect-[3/1] w-full bg-newt-bg-base 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>
  <div :class="cn('flex flex-col gap-4 p-4', 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('flex items-center gap-4', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = withDefaults(
  defineProps<{ class?: HTMLAttributes["class"]; src: string; alt?: string }>(),
  { alt: "" }
)
</script>

<template>
  <img
    :src="props.src"
    :alt="props.alt"
    :aria-hidden="props.alt === '' ? true : undefined"
    :class="
      cn(
        'h-20 w-20 shrink-0 rounded-[var(--newt-radius-lg)] bg-newt-bg-base 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>
  <div :class="cn('min-w-0 flex-1', 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"]
  /** Link to the app's page. Without it the name renders as plain text. */
  href?: string
}>()
</script>

<template>
  <component
    :is="props.href === undefined ? 'span' : 'a'"
    :href="props.href"
    :class="
      cn(
        'block truncate text-base font-bold text-newt-text-primary no-underline',
        props.href !== undefined && 'hover:underline',
        props.class
      )
    "
  >
    <slot />
  </component>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

const props = defineProps<{ class?: HTMLAttributes["class"] }>()
</script>

<template>
  <p
    :class="
      cn('mt-1 line-clamp-2 text-sm text-newt-text-secondary', props.class)
    "
  >
    <slot />
  </p>
</template>
export { default as AppInvite } from "./AppInvite.vue"
export { default as AppInviteBanner } from "./AppInviteBanner.vue"
export { default as AppInviteBody } from "./AppInviteBody.vue"
export { default as AppInviteHeader } from "./AppInviteHeader.vue"
export { default as AppInviteIcon } from "./AppInviteIcon.vue"
export { default as AppInviteInfo } from "./AppInviteInfo.vue"
export { default as AppInviteName } from "./AppInviteName.vue"
export { default as AppInviteDescription } from "./AppInviteDescription.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 App Invite 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 App Invite 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 { AppInvite } from "@/components/ui/app-invite"

export function Example() {
  return <AppInvite />
}
<script setup lang="ts">
import { AppInvite, AppInviteBanner, AppInviteBody, AppInviteHeader, AppInviteIcon, AppInviteInfo, AppInviteName, AppInviteDescription } from "@/components/ui/app-invite"
</script>

<template>
  <AppInvite />
</template>

Put the action in AppInviteBody, after AppInviteHeader, and give it w-full so it spans the card. Any Button variant works; secondary keeps the card quiet in a busy feed, primary makes adding the app the main step.

API reference

AppInviteName

PropType
href?string | undefined

Link to the app's page. Without it the name renders as plain text.

Typestring | undefined

The registry exports AppInvite, AppInviteBanner, AppInviteBody, AppInviteHeader, AppInviteIcon, AppInviteInfo, AppInviteName and AppInviteDescription. AppInvite renders an <article>; AppInviteBanner and AppInviteIcon render an <img> and take src and alt. Parts without a table accept the native attributes for the element they render; React uses className, while Vue uses class and fallthrough attributes.

Accessibility

  • Label the card with its name: give AppInviteName an id and point aria-labelledby on AppInvite at it, so a screen reader announces “Newt Helper, article”.
  • The banner and the icon are decorative next to the name, so they default to an empty alt and are hidden from assistive technology. Pass alt only when the image carries information the text does not.
  • Name the action for what it does (“Learn More”, “Add App”). When several app cards sit in the same feed, add an aria-label that includes the app name, so the links are distinguishable out of context.
  • The description is clamped to two lines visually; the full text is still read out.

Tokens

App Invite 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-app-invite.

  • --newt-radius-lg
  • --newt-bg-surface
  • --newt-text-primary
  • --newt-bg-base
  • --newt-text-secondary

Changelog

  1. featadd app-invite component#56