Pieces/Code(15)

Code pieces from Beste UI, drop-in widgets built with shadcn/ui and Tailwind CSS.

checkout.test.tsRunning
  • renders cart summary
  • applies coupon code
  • rejects expired coupon
  • calculates shipping
  • charges saved card
0 passed, 0 failed0 of 5

Test Runner

Test list that runs top to bottom, each spinner resolving into a green check or a red cross while the summary counts passes and failures and a thin bar tracks progress.

pricing.ts0 added, 0 removed
import { coupon } from "./coupon"
export function total(cart: Cart) {
const sum = cart.lines.reduce(add, 0)
return sum
const sum = cart.lines.reduce(add, 0)
const discount = coupon(cart, sum)
return sum - discount
}

Diff Reveal

Code diff whose removed and added lines slide into place one after another on mount, with the header tallying added and removed counts as they land.

members.ts
import { Sirius } from '@sirius/sdk'
const client = new Sirius(apiKey)
await client.members.create({ name })

SDK Snippet Card

A code card with a filename header and copy affordance over syntax-toned, line-numbered source.

# Database
DATABASE_URL=postgres://localhost/beste
REDIS_URL=redis://localhost:6379
# API
API_KEY=sk_test_EXAMPLE_0000
PORT=3000

Env File

Dotenv listing with sky keys, italic muted comments, and grouped sections separated by blank lines.

curl-XPOSThttps://api.beste.co/v1/users
-H"Authorization: Bearer sk_live_..."
-H"Content-Type: application/json"
-d'{"name": "Ada Lovelace"}'

cURL Command

HTTP request rendered as a curl invocation with method, URL, headers, and body across continued lines.

SELECT id, name, email
FROM users
WHERE active = true
ORDER BY created_at DESC
LIMIT 10;

SQL Query

Multi-line SQL with violet keywords, emerald string literals, and amber numerics.

TypeError: Cannot read 'name' of undefined
greet(src/utils.ts:14:12)
handler(src/server.ts:42:8)
processRequest(src/api.ts:88:4)

Stack Trace

Error headline followed by a few stack frames with file paths and amber line and column numbers.

Open command palette
K

Keyboard Shortcut

Action label paired with a row of monospace key caps joined by plus separators.

{
"name":"Beste",
"version":"1.0.0",
"active":true,
"count":42,
"owner":null
}

JSON Snippet

Pretty-printed JSON object with sky keys, emerald strings, and amber numerics.

import{useState, useEffect}from"react";
import{Button}from"@/ui/button";
import{cn}from"@/lib/utils";

Import Block

Stacked import statements with destructured names and module paths in a quiet syntax palette.

const user = await fetchUser("42");

Tokenized Line

Single-line snippet with keywords, strings, and function names colored by semantic token kind.

function greet(name) {
return 'Hi ' + name;
return `Hello, ${name}!`;
}

Diff Snippet

Compact diff card with added, removed, and context lines tinted in emerald and rose.

bun add @beste/ui

Shell Command

Single-line install or run command, prefixed with a dollar sign in monospace.

greet.ts
export function greet(name: string) {
return `Hello, ${name}!`;
}
 
console.log(greet("Beste"));

Code Snippet Card

Dark editor card with three traffic-light dots, a filename tab, and line-numbered code.

const greeting = "Hello, Beste!";ts

Code Line

One-line code snippet with a monospace pill and a tiny language tag on the right.

Markdown version