aiellie

Search

Find a component, template or page

GitHub
Components

Contact Button

Who you're talking to, at the top of a chat: their picture over a pill with their name, opening more about them.

Open full screen
fig. 01 · open it full screen from the corner

Installation

npx shadcn@latest add "@aiellie/contact-button"

shadcn needs the @aiellie registry in components.json first. npx aiellie add contact-button adds it on its first run, then installs the same way.

Contact Button is who you're talking to, at the top of a chat: their picture with their name in a pill beneath it, which opens more about them. It works for an assistant or a person.

Getting started

  1. Open their details

    It's a button, so wire it to whatever shows their details, and pass aria-expanded and aria-controls when it opens a panel.

    components/chat-header.tsx
    import { ContactButton } from "@/components/aiellie/contact-button"
    
    export function ChatHeader({ open, onOpenChange }: Props) {
      return (
        <ContactButton
          name="Ellie"
          emoji="🐘"
          src="/ellie.png"
          aria-expanded={open}
          aria-controls="info-panel"
          onClick={() => onOpenChange(!open)}
        />
      )
    }

Anatomy

<button data-slot="contact-button" aria-label="About Ellie">
  <span data-slot="avatar" />
  <span /> {/* the pill: emoji, name, chevron */}
</button>

The picture overlaps the top of the pill. Focus shows on the pill's edge, and the pill stays filled while aria-expanded is true.

Examples

Without a picture

Their initials stand in.

API reference

ContactButton

PropTypeDefaultDescription
namestringrequiredAlso names the button.
srcstringTheir picture.
emojistringSet before the name.

All other button props are forwarded.