audiocn

Channel Strip

One channel of a mixer, as a row or a console strip, composed from the parts you need.

MicrophoneShure MV7+
Live
−∞ dB

Installation

$ pnpm dlx shadcn@latest add @audiocn/channel-strip

channel-strip is layout and context only. Install the meters, faders and toggles you put inside it separately, or install a block that brings everything.

Usage

import {
  ChannelStrip,
  ChannelStripHeader,
  ChannelStripMeter,
  ChannelStripTitle,
} from "@/components/ui/channel-strip";
<ChannelStrip muted={muted}>
  <ChannelStripHeader>
    <ChannelStripTitle>Microphone</ChannelStripTitle>
  </ChannelStripHeader>
  <ChannelStripMeter>
    <LevelMeter source={analyser.meter} />
  </ChannelStripMeter>
</ChannelStrip>

Every part is optional. The smallest useful strip is a title, a meter and a mute toggle.

Anatomy

<ChannelStrip>
  <ChannelStripHeader>
    <ChannelStripIcon />
    <ChannelStripText>
      <ChannelStripTitle />
      <ChannelStripDescription />
    </ChannelStripText>
    <ChannelStripStatus />
    <ChannelStripActions />
  </ChannelStripHeader>
  <ChannelStripMeter />
  <ChannelStripFader />
  <ChannelStripValue />
  <ChannelStripControls />
  <ChannelStripNotice />
</ChannelStrip>

Examples

Console strips

With orientation="vertical", the meter and fader stand side by side.

Mic
0.0 dB
Music
0.0 dB
Game
0.0 dB

Notices

Microphone
Blocked
System audio
Paused
Paused to prevent an echo from your own stream.

How it passes settings down

A strip provides its orientation, size and disabled state to the audiocn components inside it, so meters and faders line up without extra props. When the strip is muted or dimmed, meters inside it render dimmed. Explicit props on a child always win. useChannelStrip() reads the strip's state in your own parts.

Layout

Parts place themselves on a CSS grid by area name: header, meter, fader, value, controls and notice. The grid is the strip's channel-strip-layout element, so you can rearrange a strip by overriding grid-template-areas there, for example with *:data-[slot=channel-strip-layout]:[grid-template-areas:…].

A row measures its own width with a container query. Below 36rem it puts the header on its own line, with the meter and fader full width underneath, so rows stay readable on phones and in narrow panels. From 36rem up the header sits beside the meter in a column --channel-strip-header-width wide. Set that variable on a mixer to align every row; the header wraps its status and actions onto a second line before it truncates the title.

A vertical strip keeps its width inside a mixer. When the strips do not fit, the mixer's channels scroll instead of squeezing them.

Theming

Variable or attributeMeaning
--channel-accentSet by accent, drawn as a colour tag
--channel-strip-widthWidth of a vertical strip, default 6.5rem
--channel-strip-header-widthHeader column of a wide row, default 12rem
data-muted, data-solo, data-dimmed, data-selected, data-disabledChannel state
data-clippingA meter inside the strip is clipping
data-orientation, data-variant, data-sizeCurrent settings

Accessibility

The strip is a group named by ChannelStripTitle. A notice is a status, or an alert for the destructive variant. State is never shown by colour alone: pair a muted strip with a pressed mute toggle and a status label.

API reference

ChannelStrip

Prop

Type

ChannelStripStatus

Prop

Type

ChannelStripNotice

Prop

Type