Alignment controls

Align and distribute selected elements – left, centre, right, top, middle, bottom.

Install

npx shadcn@latest add https://substrate.georgedrury.co.uk/r/alignment-controls

Examples

Default

The first row shows all controls including distribute. The second row hides distribute with showDistribute={false}.

"use client"

import { AlignmentControls, type AlignAction } from "@/components/substrate/alignment-controls"

Props

PropTypeDefaultDescription
onAlign(action: AlignAction) => void—Called with the alignment action
showDistributebooleantrueShow distribute horizontal/vertical
disabledboolean—Disables all buttons

AlignAction values

left · center-h · right · top · center-v · bottom · distribute-h · distribute-v