Nasaq
Components

SourceBadge

Where a record came from (a plugin, an integration, a feed) as a small icon-and-name chip, with an icon-only compact form, a brand-coloured icon and an optional external link.

PreviewOpen ↗

Code

import { SourceBadge } from "@fadymondy/nasaq/web";import { Database, Rss } from "lucide-react";export function Sources() {  return (    <div className="flex gap-2">      <SourceBadge label="Postgres" icon={Database} />      <SourceBadge label="Blog feed" icon={Rss} color="var(--nq-accent-brand)" />      <SourceBadge compact label="Postgres" icon={Database} />    </div>  );}

Data Display · beta

Live examples and controls: SourceBadge in the lab.

Install

npx shadcn@latest add https://docs.nasaqui.com/r/source-badge.json

A chip that says where something came from: "GitHub", "Google Drive", "RSS". The icon can carry the source's brand colour; the label stays in text colour.

When to use

  • Rows, search results and cards that mix records from several sources.
  • Imported items, so people know which system owns them.

When not to use

Import

import { SourceBadge } from "@fadymondy/nasaq/web";
// inside this monorepo: "@nasaq/web"

Quick start

import { SourceBadge } from "@fadymondy/nasaq/web";
import { Database, Rss } from "lucide-react";

export function Sources() {
  return (
    <div className="flex gap-2">
      <SourceBadge label="Postgres" icon={Database} />
      <SourceBadge label="Blog feed" icon={Rss} color="var(--nq-accent-brand)" />
      <SourceBadge compact label="Postgres" icon={Database} />
    </div>
  );
}

Anatomy

SourceBadge                     data-slot="source-badge"  (span, or a when href is set)
├─ icon                         data-slot="source-badge-icon", coloured by `color`
└─ label                        hidden when compact

API

SourceBadge: every span prop except children, plus:

PropTypeDefaultDescription
labelstringrequiredThe source's name, already localised. In compact mode it is the accessible name and tooltip.
iconLucideIcon | ReactNodeA lucide icon, or any node (an <svg> mark, an <img>).
colorstringColour of the icon only.
compactbooleanfalseIcon only.
size"sm" | "md""sm"
hrefstringOpens the source in a new tab.

Accessibility

  • Compact badges are role="img" with the label as aria-label and title.
  • With href, it is a real link with a focus ring and rel="noopener noreferrer".
  • The icon is decorative; the label carries the meaning, so colour is never the only cue.

RTL & i18n

  • Icon at the inline start; the chip mirrors with the layout. Pass a localised label.

Styling & tokens

  • bg-secondary, border-border, rounded-control, text-caption / text-label. Target [data-slot="source-badge"].

Do / Don't

  • Do keep the label short: the product name, not "Imported from…".
  • Don't colour the label; brand colours rarely have enough contrast as text.

Lab

https://docs.nasaqui.com/?path=/docs/components-data-display-source-badge--docs

On this page