Broadcast composer

Choose a channel, edit a short bulletin, and post it to the station’s local board.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/broadcast-composer.json

Usage

import { Cyber } from "@/components/ui/cyber"
import Recipe from "@/components/recipes/broadcast-composer"

export default function App() {
  return (
    <Cyber>
      <Recipe />
    </Cyber>
  )
}

Source

"use client"

import { useState } from "react"
import { Send } from "lucide-react"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Select } from "@/components/ui/select"
import { Textarea } from "@/components/ui/textarea"
import "./recipe-layout.css"

const channels = ["Ferry desk", "Night studio", "All districts"]

export default function BroadcastComposer() {
  const [channel, setChannel] = useState(channels[0])
  const [draft, setDraft] = useState("Last ferry boards at the south pier. Have your pass ready.")
  const [posted, setPosted] = useState<{ channel: string; body: string } | null>(null)

  return (
    <div className="sink-stack">
      <form className="sink-stack" onSubmit={event => {
        event.preventDefault()
        const body = draft.trim()
        if (!body) return
        setPosted({ channel, body })
        setDraft("")
      }}>
        <Select label="Broadcast channel" value={channel} onValueChange={value => { if (value) setChannel(value) }}
          options={channels.map(name => ({ label: name, value: name }))} />
        <Textarea label="Bulletin" value={draft} onValueChange={setDraft} maxLength={160} rows={2}
          placeholder="Write a short bulletin" />
        <div className="sink-row">
          <Button tone="signal" size="sm" type="submit" disabled={!draft.trim()}><Send aria-hidden /> Post bulletin</Button>
        </div>
      </form>
      <div role="status">
        {posted && <div className="sink-stack">
          <div className="sink-row"><Badge tone="ok">Posted</Badge><strong>{posted.channel}</strong></div>
          <p>{posted.body}</p>
        </div>}
      </div>
    </div>
  )
}

Components in this recipe

  • Select — A labelled trigger that opens a list of options to choose from.
  • Textarea — A labelled multi-line input with a character count.
  • Button — A cut-corner button with a raised tab, five tones, and a press flash. Enable the cipher prop to scramble the label and briefly tear the frame on hover.
  • Badge — A small cut label in seven tones, with count and status variants.

Resources

View as Markdown