NewCard
The v3 mock's .newg: the dashed "+ New group" card at the end of a card grid. A real button.
import { NewCard } from '@ergasti/bricks';Examples
Add card
The dashed "create one" tile that sits at the end of a card grid.
Code
import { useState } from 'react';
import { NewCard } from '@ergasti/bricks';
function Add() {
const [clicks, setClicks] = useState(0);
return (
<div style={{ maxWidth: 300 }}>
<NewCard title="+ New group" sub="Pick the creators by hand" onClick={() => setClicks(clicks + 1)} />
<small>Pressed {clicks} times</small>
</div>
);
}Props
Prop
Type
Design guidance
How the BRICKS design system uses NewCard. Written in docs/content/components/NewCard.md; the props above are read from the code, which wins where the two disagree.
The dashed "+ New group" card at the end of a card grid; use it as the create action that sits in the grid itself.
NewCard is the v3 mock's .newg: a full-width button at least 190px tall with a 1.5px dashed grey border on the card surface, a bold title and an optional muted sub line, centred. On hover the border and text turn raspberry. It is a real button, so it sits in the tab order after the last card.
Anatomy
- Button (
button.kit-newg): flex column, centred, 6px gap,--r-lgradius, 15px text. - Title (
b): "+ New group". - Sub (
.kit-newg-sub, optional): 12px--ink-3.
Variants
| Content | Look | When |
|---|---|---|
title only | Title centred | Space is short |
title + sub | Title over a hint | Explaining what the new item does |
States
| State | Trigger | Look |
|---|---|---|
| Default | — | Dashed #C9CBD4 border |
| Hover | pointer | Border and text --rasp |
| Focus-visible | Tab | Shared kit focus ring |
Usage
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16 }}>
<GroupCard name="Ramadan glow squad" tone="lime" members={[{ id: 1, name: 'Laila Saeed' }, { id: 2, name: 'Karim Hosny' }]}
commission={{ state: 'set', kind: 'percent', value: '20' }} onOpen={() => {}} />
<NewCard title="+ New group" sub="Group creators to ask for a special commission" onClick={() => {}} />
</div>Arabic:
<NewCard title="+ مجموعة جديدة" onClick={openNewGroup} />Where it appears
- Brand › Creators › Groups tab, last cell of the group card grid (opens the New group drawer with
GroupForm). - Screen: Creators.
Guidelines
Do
- Place it last in the grid so it inherits the grid's column width.
- Start the title with "+".
Don't
- Don't use it outside a card grid; use a Button in the header instead.
- Don't show it when the user can't create (hide it rather than disable it).
RTL and Arabic
- Centred content: nothing to mirror. Arabic titles use the Cairo font inherited from the page.
Tokens
--card, --r-lg, --rasp (hover), --ink-3 (sub).
Accessibility
- A native
type="button"; its accessible name is the title plus the sub. - Keyboard: Tab, Enter/Space.
Found in the source
- Its tests cover: “opens with click, Enter and Space”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
See also: Avatar · AvatarStack · ButtonLink
Source
src/kit/primitives/NewCard.tsx (line 5) on GitHub.