BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/plate/caption

Caption

plate/caption
FreeComponent

A text field for adding captions to media elements.

Live preview

live · rendered by the registry
Rendered by plate on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://platejs.org/r/caption.json

Source

src/registry/ui/caption.tsxplatejs.org/r/caption.json
1'use client';
2
3import * as React from 'react';
4
5import type { VariantProps } from 'class-variance-authority';
6
7import {
8 Caption as CaptionPrimitive,
9 CaptionTextarea as CaptionTextareaPrimitive,
10 useCaptionButton,
11 useCaptionButtonState,
12} from '@platejs/caption/react';
13import { createPrimitiveComponent } from '@udecode/cn';
14import { cva } from 'class-variance-authority';
15
16import { Button } from '@/components/ui/button';
17import { cn } from '@/lib/utils';
18
19const captionVariants = cva('max-w-full', {
20 defaultVariants: {
21 align: 'center',
22 },
23 variants: {
24 align: {
25 center: 'mx-auto',
26 left: 'mr-auto',
27 right: 'ml-auto',
28 },
29 },
30});
31
32export function Caption({
33 align,
34 className,
35 ...props
36}: React.ComponentProps<typeof CaptionPrimitive> &
37 VariantProps<typeof captionVariants>) {
38 return (
39 <CaptionPrimitive
40 {...props}
41 className={cn(captionVariants({ align }), className)}
42 />
43 );
44}
45
46export function CaptionTextarea(
47 props: React.ComponentProps<typeof CaptionTextareaPrimitive>
48) {
49 return (
50 <CaptionTextareaPrimitive
51 {...props}
52 className={cn(
53 'mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit',
54 'focus:outline-none focus:[&::placeholder]:opacity-0',
55 'text-center print:placeholder:text-transparent',
56 props.className
57 )}
58 />
59 );
60}
61
62export const CaptionButton = createPrimitiveComponent(Button)({
63 propsHook: useCaptionButton,
64 stateHook: useCaptionButtonState,
65});

What it pulls in

npm packages

  • @udecode/cn
  • @platejs/caption

Other registry items

  • button

Files it writes

  • src/registry/ui/caption.tsx

Facts

Registry
plate
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on plate platejs.org udecode/plate on GitHub Raw registry item This item as JSON

More from plate

All 324 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ai-kitai-kitplateComponentsFree1 dep
AI Menuai-menuplateComponentsFree5 deps · 2 files
AI Leafai-nodeplateComponentsFreeno deps
AI Toolbar Buttonai-toolbar-buttonplateComponentsFree1 dep
align-base-kitalign-base-kitplateComponentsFree1 dep
align-kitalign-kitplateComponentsFree1 dep
Align Toolbar Buttonalign-toolbar-buttonplateComponentsFree1 dep
autoformat-classic-kitautoformat-classic-kitplateComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex