dentil

Object Header

ObjectHeader is the small row at the top of a record page. It names the object type and gives one-click copies of the page URL and the object ID, with the avatars of anyone else looking at the same record.

@dentil/object-header
On this page
Invoice

£1,250.00

Billed to Ada Lovelace · Due 1 Dec 2026

Installation

pnpm dlx shadcn@latest add @dentil/object-header
npx shadcn@latest add @dentil/object-header
yarn dlx shadcn@latest add @dentil/object-header
bunx --bun shadcn@latest add @dentil/object-header

Files land in components/dentil/object-header/. It uses no shadcn components, only lucide-react icons. The avatars animate in with tw-animate-css, which shadcn sets up by default.

Usage

Put it above the page heading. Its 20px side padding and 12px top padding line up with @dentil/dashboard-layout. There's no toast built in, so pass onCopy to show one with your own toaster.

import { Receipt } from 'lucide-react';
import { toast } from 'sonner';

import { ObjectHeader } from '@/components/dentil/object-header/object-header';

<ObjectHeader
  icon={Receipt}
  title="Invoice"
  id={invoice.id}
  url
  onCopy={() => toast.success('Copied to clipboard')}
/>
<DashboardHeader>
  <DashboardHeading>{invoice.total}</DashboardHeading>
</DashboardHeader>

Share links

Pass a string to url to copy something other than the page address.

// Copy a link that works for teammates in other accounts, instead of the page's own address.
<ObjectHeader
  icon={Receipt}
  title="Invoice"
  id={invoice.id}
  url={`${origin}/b/${account.id}?destination=${encodeURIComponent(pathname)}`}
/>

Presence

presence takes a plain array, so it works with any realtime provider. Put the current user first: earlier avatars sit on top of later ones. Names show on hover.

Customer

Liveblocks

Map the current user and the others in the room to users.

import { useOthersMapped, useSelf } from '@liveblocks/react';

function InvoiceHeader({ invoice }: { invoice: Invoice }) {
  const self = useSelf((me) => me.info);
  const others = useOthersMapped((other) => other.info);

  return (
    <ObjectHeader
      icon={Receipt}
      title="Invoice"
      id={invoice.id}
      url
      presence={[
        ...(self ? [{ id: 'self', name: self.name, avatar: self.avatar }] : []),
        ...others.map(([connectionId, info]) => ({ id: String(connectionId), name: info.name, avatar: info.avatar })),
      ]}
    />
  );
}

API reference

ObjectHeader

PropTypeDefaultDescription
titleReactNode—The object type, such as "Invoice" or "Customer". Truncates.
iconLucideIcon—Icon shown before the title at 12px.
idstring—The object ID. Shown as a copy button labelled with the ID, truncated past 240px.
urlstring | true—Shows a copy button labelled "URL". Pass the URL to copy, or true to copy window.location.href at the moment of the click, which is safe to render on the server.
presenceObjectHeaderUser[]—People viewing the record, as { id?, name, avatar? }. Rendered with ObjectHeaderPresence. Hidden when empty.
onCopy(value: string) => void—Called after a value is written to the clipboard, e.g. to show a toast.
childrenReactNode—Extra actions, placed between the avatars and the copy buttons.
classNamestring—Merged onto the row.
…propsOmit<ComponentProps<'div'>, 'title' | 'id' | 'onCopy'>—Other div props.

ObjectHeaderCopyButton

PropTypeDefaultDescription
valuestring | (() => string)—Text written to the clipboard, or a function that returns it when clicked.
onCopy(value: string) => void—Called after the value is copied.
childrenReactNode—The label, in a monospace font. Truncates.
aria-labelstring'Copy'Accessible name. Reads "Copied" for two seconds after a copy.

ObjectHeaderPresence

PropTypeDefaultDescription
usersObjectHeaderUser[]—People viewing the record. Each needs a name; avatar is an image URL, and without one the avatar shows the first letter of the name. id is the React key and falls back to the name.
maxnumber5Avatars shown before the rest collapse into a "+N" count. Hover the count to see their names.