shadcn.io is not affiliated with official shadcn/ui
Shadcn Prose for React and Tailwind
Typography styles for HTML content.
Taxing Laughter: The Joke Tax Chronicles
Once upon a time, in a far-off land, there was a very lazy king who spent all day lounging on his throne. One day, his advisors came to him with a problem: the kingdom was running out of money.
The King's Plan
The king thought long and hard, and finally came up with a brilliant plan: he would tax the jokes in the kingdom.
"After all," he said, "everyone enjoys a good joke, so it's only fair that they should pay for the privilege."
The Joke Tax
The king's subjects were not amused. They grumbled and complained, but the king was firm:
- 1st level of puns: 5 gold coins
- 2nd level of jokes: 10 gold coins
- 3rd level of one-liners : 20 gold coins
As a result, people stopped telling jokes, and the kingdom fell into a gloom. But there was one person who refused to let the king's foolishness get him down: a court jester named Jokester.
Jokester's Revolt
Jokester began sneaking into the castle in the middle of the night and leaving jokes all over the place: under the king's pillow, in his soup, even in the royal toilet. The king was furious, but he couldn't seem to stop Jokester.
And then, one day, the people of the kingdom discovered that the jokes left by Jokester were so funny that they couldn't help but laugh. And once they started laughing, they couldn't stop.
The People's Rebellion
The people of the kingdom, feeling uplifted by the laughter, started to tell jokes and puns again, and soon the entire kingdom was in on the joke.
| King's Treasury | People's happiness |
|---|---|
| Empty | Overflowing |
| Modest | Satisfied |
| Full | Ecstatic |
The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax. Jokester was declared a hero, and the kingdom lived happily ever after.
The moral of the story is: never underestimate the power of a good laugh and always be careful of bad ideas.
Installation
bunx --bun shadcn@latest add https://kit.dev/r/prose.jsonpnpm dlx shadcn@latest add https://kit.dev/r/prose.jsonnpx shadcn@latest add https://kit.dev/r/prose.jsonyarn shadcn@latest add https://kit.dev/r/prose.jsonInstall the following dependencies:
bun add @ark-ui/reactpnpm add @ark-ui/reactnpm install @ark-ui/reactyarn add @ark-ui/reactAdd the following to your globals.css.
@layer components {
.prose h1:not(.not-prose h1) {
font-size: var(--text-2xl);
font-weight: 800;
line-height: var(--text-2xl--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h2:not(.not-prose h2) {
padding-bottom: calc(var(--spacing) * 2);
margin-top: calc(var(--spacing) * 8);
font-size: var(--text-xl);
font-weight: 600;
line-height: var(--text-xl--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h2:not(.not-prose h2):first-child {
margin-top: 0;
}
.prose h3:not(.not-prose h3) {
margin-top: calc(var(--spacing) * 8);
font-size: var(--text-lg);
font-weight: 600;
line-height: var(--text-lg--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h3:not(.not-prose h3):first-child {
margin-top: 0;
}
.prose h4:not(.not-prose h4) {
margin-top: calc(var(--spacing) * 8);
font-size: var(--text-lg);
font-weight: 600;
line-height: var(--text-lg--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h4:not(.not-prose h4):first-child {
margin-top: 0;
}
.prose h5:not(.not-prose h5) {
margin-top: calc(var(--spacing) * 8);
font-size: var(--text-lg);
font-weight: 600;
line-height: var(--text-lg--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h5:not(.not-prose h5):first-child {
margin-top: 0;
}
.prose h6:not(.not-prose h6) {
margin-top: calc(var(--spacing) * 8);
font-size: var(--text-base);
font-weight: 600;
line-height: var(--text-base--line-height);
letter-spacing: var(--tracking-tight);
scroll-margin: calc(var(--spacing) * 20);
}
.prose h6:not(.not-prose h6):first-child {
margin-top: 0;
}
.prose h1:not(.not-prose h1) + p, .prose h2:not(.not-prose h2) + p, .prose h3:not(.not-prose h3) + p, .prose h4:not(.not-prose h4) + p, .prose h5:not(.not-prose h5) + p, .prose h6:not(.not-prose h6) + p {
margin-top: 0;
}
.prose p:not(.not-prose p) {
line-height: 1.75;
}
.prose p:not(.not-prose p):not(:first-child) {
margin-top: calc(var(--spacing) * 6);
}
.prose li:not(.not-prose li) {
line-height: 1.75;
}
.prose a:not(.not-prose a) {
font-weight: 500;
color: var(--color-primary);
text-decoration: underline;
text-underline-offset: var(--spacing);
}
.prose blockquote:not(.not-prose blockquote) {
padding-left: calc(var(--spacing) * 6);
margin-top: calc(var(--spacing) * 6);
font-style: italic;
border-left: 2px solid var(--color-border);
}
.prose table:not(.not-prose table) {
width: 100%;
margin-top: calc(var(--spacing) * 6);
margin-bottom: calc(var(--spacing) * 6);
overflow-y: auto;
}
.prose table:not(.not-prose table) thead tr {
padding: 0;
margin: 0;
border-top: 1px solid var(--color-border);
}
.prose table:not(.not-prose table) thead tr:nth-child(even) {
background-color: var(--color-muted);
}
.prose table:not(.not-prose table) th {
padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
font-weight: 700;
text-align: left;
border: 1px solid var(--color-border);
}
.prose table:not(.not-prose table) th[align="center"] {
text-align: center;
}
.prose table:not(.not-prose table) th[align="right"] {
text-align: right;
}
.prose table:not(.not-prose table) tbody tr {
padding: 0;
margin: 0;
border-top: 1px solid var(--color-border);
}
.prose table:not(.not-prose table) tbody tr:nth-child(even) {
background-color: var(--color-muted);
}
.prose table:not(.not-prose table) td {
padding: calc(var(--spacing) * 2) calc(var(--spacing) * 4);
text-align: left;
border: 1px solid var(--color-border);
}
.prose table:not(.not-prose table) td[align="center"] {
text-align: center;
}
.prose table:not(.not-prose table) td[align="right"] {
text-align: right;
}
.prose ul:not(.not-prose ul) {
margin-top: calc(var(--spacing) * 6);
margin-left: calc(var(--spacing) * 6);
list-style: disc;
}
.prose ul:not(.not-prose ul) > li {
margin-top: calc(var(--spacing) * 2);
}
.prose ul:not(.not-prose ul) p {
display: inline;
margin-top: 0;
margin-bottom: 0;
}
.prose ol:not(.not-prose ol) {
margin-top: calc(var(--spacing) * 6);
margin-left: calc(var(--spacing) * 6);
list-style: decimal;
}
.prose ol:not(.not-prose ol) > li {
margin-top: calc(var(--spacing) * 2);
}
.prose ol:not(.not-prose ol) p {
display: inline;
margin-top: 0;
margin-bottom: 0;
}
.prose img:not(.not-prose img), .prose picture:not(.not-prose picture), .prose video:not(.not-prose video) {
margin-top: calc(var(--spacing) * 6);
margin-bottom: calc(var(--spacing) * 6);
}
.prose picture > img:not(.not-prose picture > img) {
margin-top: 0;
margin-bottom: 0;
}
.prose kbd:not(.not-prose kbd) {
padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 1.5);
font-size: var(--text-xs);
font-weight: 600;
line-height: var(--text-xs--line-height);
background-color: var(--color-muted);
border-radius: calc(var(--radius) - 2px);
}
.prose hr {
margin-top: calc(var(--spacing) * 10);
margin-bottom: calc(var(--spacing) * 10);
}
.prose dl:not(.not-prose dl) {
margin-top: calc(var(--spacing) * 6);
margin-bottom: calc(var(--spacing) * 6);
}
.prose dl:not(.not-prose dl) dt {
margin-top: calc(var(--spacing) * 6);
font-weight: 600;
letter-spacing: var(--tracking-tight);
}
.prose dl:not(.not-prose dl) dt:first-child {
margin-top: 0;
}
.prose details:not(.not-prose details) {
margin-top: calc(var(--spacing) * 6);
}
.prose details:not(.not-prose details) summary {
margin-top: calc(var(--spacing) * 6);
font-weight: 600;
letter-spacing: var(--tracking-tight);
cursor: pointer;
}
.prose details:not(.not-prose details) p:first-of-type {
margin-top: calc(var(--spacing) * 2);
}
.prose mark:not(.not-prose mark) {
background-color: var(--color-yellow-300);
}
.prose small:not(.not-prose small) {
font-size: var(--text-xs);
line-height: 1;
}
.prose figure:not(.not-prose figure) {
margin-top: calc(var(--spacing) * 6);
margin-bottom: calc(var(--spacing) * 6);
}
.prose figure:not(.not-prose figure) img {
margin-top: 0;
margin-bottom: 0;
border-radius: var(--radius);
}
.prose figure:not(.not-prose figure) figcaption {
margin-top: calc(var(--spacing) * 2);
font-size: var(--text-sm);
font-weight: 500;
line-height: var(--text-sm--line-height);
color: var(--color-muted-foreground);
}
.prose code:not(.not-prose code) {
padding: calc(var(--spacing) * 0.5) calc(var(--spacing) * 1.5);
font-size: var(--text-xs);
font-weight: 500;
line-height: var(--text-xs--line-height);
color: var(--color-muted-foreground);
background-color: var(--color-muted);
border-radius: var(--radius-sm);
}
}Copy and paste the following code into your project.
"use client";
import { ark } from "@ark-ui/react/factory";
import { cn } from "@/lib/utils";
export const Prose = (props: React.ComponentProps<typeof ark.div>) => {
const { className, ...rest } = props;
return (
<ark.div
className={cn("prose mx-auto max-w-[65ch]", className)}
data-slot="prose"
{...rest}
/>
);
};Update the import paths to match your project setup.
Usage
import { Prose } from "@/components/ui/prose";
import { ScrollArea } from "@/components/ui/scroll-area";<div className="overflow-hidden">
<ScrollArea className="h-[350px] rounded-xl border">
<Prose className="max-w-full p-8">
<h1>Taxing Laughter: The Joke Tax Chronicles</h1>
<p>
Once upon a time, in a far-off land, there was a very lazy king who
spent all day lounging on his throne. One day, his advisors came to
him with a problem: the kingdom was running out of money.
</p>
<h2>The King's Plan</h2>
<p>
The king thought long and hard, and finally came up with{" "}
<a href="#">a brilliant plan</a>: he would tax the jokes in the
kingdom.
</p>
<blockquote>
"After all," he said, "everyone enjoys a good joke, so
it's only fair that they should pay for the privilege."
</blockquote>
<h3>The Joke Tax</h3>
<p>
The king's subjects were not amused. They grumbled and
complained, but the king was firm:
</p>
<ul>
<li>1st level of puns: 5 gold coins</li>
<li>2nd level of jokes: 10 gold coins</li>
<li>3rd level of one-liners : 20 gold coins</li>
</ul>
<p>
As a result, people stopped telling jokes, and the kingdom fell into a
gloom. But there was one person who refused to let the king's
foolishness get him down: a court jester named Jokester.
</p>
<h3>Jokester's Revolt</h3>
<p>
Jokester began sneaking into the castle in the middle of the night and
leaving jokes all over the place: under the king's pillow, in his
soup, even in the royal toilet. The king was furious, but he
couldn't seem to stop Jokester.
</p>
<p>
And then, one day, the people of the kingdom discovered that the jokes
left by Jokester were so funny that they couldn't help but laugh.
And once they started laughing, they couldn't stop.
</p>
<h3>The People's Rebellion</h3>
<p>
The people of the kingdom, feeling uplifted by the laughter, started
to tell jokes and puns again, and soon the entire kingdom was in on
the joke.
</p>
<div>
<table>
<thead>
<tr>
<th>King's Treasury</th>
<th>People's happiness</th>
</tr>
</thead>
<tbody>
<tr>
<td>Empty</td>
<td>Overflowing</td>
</tr>
<tr>
<td>Modest</td>
<td>Satisfied</td>
</tr>
<tr>
<td>Full</td>
<td>Ecstatic</td>
</tr>
</tbody>
</table>
</div>
<p>
The king, seeing how much happier his subjects were, realized the
error of his ways and repealed the joke tax. Jokester was declared a
hero, and the kingdom lived happily ever after.
</p>
<p>
The moral of the story is: never underestimate the power of a good
laugh and always be careful of bad ideas.
</p>
</Prose>
</ScrollArea>
</div>Accessibility
| Key | Description |
|---|---|
Enter | Activate the focused item. |
Demos
A
Blockquote
Details
Dl
H1
H2
H3
H4
H5
H6
Inline Code
Kbd
List
Mark
Media
Not Prose
Ol
P
Separator
Small
Table
API Reference
Prose
div