npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shadcn-chat-cli

v0.3.1

Published

Add reusable shadcn chat components to your app.

Downloads

461

Readme

shadcn-chat

A CLI for adding chat components to your project.

Installation

Some of the components rely on shadcn-ui, so make sure to have it installed.

add

Use the add command to add components to your project.

It is recommended to install all components at once:

npx shadcn-chat-cli add --all

To view a list of all available components run the following command:

npx shadcn-chat-cli add

Otherwise, install individual components by running:

npx shadcn-chat-cli add [component]

image

The components will be installed in a subdirectory of the components folder: src/components/ui/chat

Usage & Examples

All of the below primitives are unstyled and you can add styling in any way you'd like - for instance with className.

Chat components

This is an example of how to quickly build stunning Chat UIs.

import { ChatMessageList } from "@/components/ui/chat/chat-message-list";
import { ChatBubble, ChatBubbleAvatar, ChatBubbleMessage } from "@/components/ui/chat/chat-bubble";
import { ChatInput } from "@/components/ui/chat/chat-input";

<>
  <ChatMessageList>
    <ChatBubble>
      <ChatBubbleAvatar />
      <ChatBubbleMessage>
        Message and other content here
      </ChatBubbleMessage>
    </ChatBubble>
  </ChatMessageList>
  <div className="flex-1" />
  <ChatInput
    placeholder="Type your message here..."
  />
  <Button
    size="sm" className="ml-auto gap-1.5">
    Send Message
    <CornerDownLeft className="size-3.5" />
  </Button>
</>

For more comprehensive examples, check out this, this & this from the source code.

Expandable Chat component

v.0.2.0 adds additional functionality by adding an expandable chat component that you can use in conjunction with the other components to quickly build a chat-support type feature in your application.

ChatSupport.tsx:

import { ChatBubble, ChatBubbleAvatar, ChatBubbleMessage } from '@/components/ui/chat/chat-bubble'
import { ChatInput } from '@/components/ui/chat/chat-input'
import { ExpandableChat, ExpandableChatHeader, ExpandableChatBody, ExpandableChatFooter } from '@/components/ui/chat/expandable-chat'
import { ChatMessageList } from '@/components/ui/chat/chat-message-list'

export default function ChatSupport() {
  return (
    <ExpandableChat
      size='lg'
      position='bottom-right'>
      <ExpandableChatHeader className='flex-col text-center justify-center'>
        <h1 className='text-xl font-semibold'>Chat with our AI ✨</h1>
        <p>Ask any question for our AI to answer</p>
        <div className='flex gap-2 items-center pt-2'>
          <Button
            variant='secondary'
          >
            New Chat
          </Button>
          <Button
            variant='secondary'
          >
            See FAQ
          </Button>
        </div>
      </ExpandableChatHeader>
      <ExpandableChatBody>
        <ChatMessageList>
          <ChatBubble>
            <ChatBubbleAvatar/>
            <ChatBubbleMessage>
              {message.content}
            </ChatBubbleMessage>
          </ChatBubble>
        </ChatMessageList>
      </ExpandableChatBody>
      <ExpandableChatFooter>
        <ChatInput />
        <Button
          type="submit" size="icon">
          <Send className="size-4" />
        </Button>
      </ExpandableChatFooter>
    </ExpandableChat>
  )
}

And then use that component on all your sites by placing it in layout.tsx (Next.js)

layout.tsx:

 <html lang="en">
      <body>
        </main>
          {children}
          <ChatSupport />
        </main>
      </body>

Check out this for a better overview of the api.