Getting Started
Components
- Accordion
- Advanced Toast
- AlertMessage
- ArrowButton
- Arrows
- Avatar
- Backdrop
- Basic Toast
- Breadcrumb
- Button
- CardBackground
- Card
- Carousel
- Chapters
- ChatBody
- ChatButton
- ChatHeader
- ChatInput
- ChatMessageActions
- ChatMessageEditor
- ChatMessage
- ChatTypingIndicator
- ChatWindowCsatPrompt
- ChatWindowQuote
- ChatWindow
- CheckboxSelect
- Checkbox
- Checkboxes
- Chip
- ChoiceExpander
- Clickable
- ContentReview
- Countdown
- CriteriaDates
- CriteriaParticipants
- CriteriaTransports
- Date Field
- Datepicker
- Dropdown
- ElasticHeight
- ExpandableCard
- ExpandableText
- Filter
- FloatingLabelTextField
- Form Control
- Form Label
- Frame
- HamburgerIcon
- Heading
- Image
- JourneyCard
- LayerHeader
- Layer
- Link
- Loader
- Number Field
- PageNavigation
- Pagination
- Paragraph
- Password
- Phone Field
- Popin
- Portal
- ProductThumbnail
- Promises
- Prose
- Radio Group
- RadioSelect
- Radio
- Range
- Scrollbar
- Select
- SidebarLayout
- SliderFrame
- SparkleWrapper
- Spinner
- Switch
- Table
- Tabs
- Tag
- TextField
- Toggle
- Tooltip
- ValidationMessage
Welcome to Prose
The Prose component renders rich HTML content with automatic typography styling.
- Supports all standard HTML elements
- Applies beautiful default styles
- Perfect for blog posts and articles
import { Prose } from '@/ui/Prose';
export function ProseDemo() {
const htmlContent = `
<h2>Welcome to Prose</h2>
<p>The Prose component renders rich HTML content with automatic typography styling.</p>
<ul>
<li>Supports all standard HTML elements</li>
<li>Applies beautiful default styles</li>
<li>Perfect for blog posts and articles</li>
</ul>
`;
return <Prose text={htmlContent} className="max-w-prose" />;
}
Installation
npx shadcn@latest add https://develop.trident-ui.pro.clubmed/r/prose.json
Usage
import { Prose } from '@/docs/lib/ui/prose';
export function Component() {
const htmlContent = `
<h2>Article Title</h2>
<p>This is a paragraph with <strong>bold text</strong> and <em>italic text</em>.</p>
<ul>
<li>First item</li>
<li>Second item</li>
</ul>
`;
return <Prose text={htmlContent} className="max-w-prose" />;
}API Reference
Prose
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | (required) | HTML string to render. Returns null if empty. Content is rendered using dangerouslySetInnerHTML. |
className | string | undefined | Additional CSS classes to apply. The "prose" class is always applied automatically. |
The component also accepts all standard HTML div attributes via ComponentPropsWithoutRef<"div">.
Notes
- HTML Rendering: The component uses
dangerouslySetInnerHTMLto render the HTML content. Ensure thetextprop contains safe, sanitized HTML to prevent XSS attacks. - Prose Styling: The component automatically applies the
proseclass, which typically provides beautiful typography defaults for rendered HTML content (commonly used with Tailwind's typography plugin). - Empty Text: If the
textprop is empty or falsy, the component returnsnulland renders nothing. - Ref Forwarding: The component forwards refs to the underlying div element, allowing parent components to access the DOM node.
- Custom Styling: You can pass additional classes via
classNameto customize the appearance or constrain the width (e.g.,max-w-prosefor optimal reading width). - Standard Attributes: All standard HTML div attributes (like
id,data-*,aria-*) can be passed and will be forwarded to the div element. - Use Cases: Perfect for rendering blog posts, articles, documentation, CMS content, or any rich text content that includes formatted HTML.