Rose Feature
A rose Moon Sphere on warm clay paper beside a short invitation with one link and a save button.
"use client"
import { useEffect, useRef, useState } from "react"
import { cn } from "cn"
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import { MoonSphere } from "@/components/orbs/moon-sphere"
import { Button, buttonVariants } from "@/components/ui/button"
// The copy: change text here, not in the markup.
const COPY = {
eyebrow: "The Lantern Post / after hours",
title: "A little room for the things you notice.",
body: "A monthly letter about design, materials, and the useful details at the edge of a working day.",
cta: "See the letter layout",
save: "Save this study",
saved: "Saved · undo",
} as const
/** On warm clay paper, a rose Moon Sphere sits beside a short invitation with one link and a save button. */
export default function MoonSphereRoseFeature() {
return (
<div className="theme-clay relative isolate w-full max-w-[1240px] overflow-hidden rounded-[20px] bg-background text-foreground [--font-display:var(--font-serif)] max-[600px]:rounded-[14px]">
<div className="relative isolate grid min-h-[500px] grid-cols-[1fr_1fr] items-center gap-14 overflow-hidden p-16 max-[950px]:gap-8 max-[950px]:p-10 max-[600px]:grid-cols-1 max-[600px]:gap-7 max-[600px]:p-[32px_24px]">
<div>
<header className="relative z-2 grid max-w-[540px] min-w-0 gap-6">
<Eyebrow variant="mono">{COPY.eyebrow}</Eyebrow>
<h4 className="font-display text-[length:clamp(34px,4vw,54px)] leading-[1.1] font-normal tracking-[-0.035em] text-balance max-[600px]:text-[36px]">
{COPY.title}
</h4>
<div className="max-w-[480px] text-base/7 text-muted-foreground">
<p>{COPY.body}</p>
</div>
</header>
<div className="relative z-2 mt-7 flex flex-wrap items-center gap-3">
<a
href="#"
data-slot="button"
className={cn(
buttonVariants({ size: "lg" }),
"h-auto min-h-10 max-w-full py-2.5 text-center whitespace-normal"
)}
>
{COPY.cta}
</a>
<SaveButton />
</div>
</div>
<div className="relative isolate order-first grid h-full min-h-[320px] place-items-center max-[600px]:order-none max-[600px]:min-h-[280px]">
<Orb color="oklch(0.78 0.13 350)" size={360} />
</div>
</div>
</div>
)
}
function Orb({
color = "oklch(0.75 0.12 232)",
size = 280,
grow = 1,
className,
}: {
color?: string
size?: number
grow?: number
className?: string
}) {
const { ref, width } = useWidth(Math.min(size, 240))
return (
<div
ref={ref}
aria-hidden="true"
className={cn("relative aspect-square shrink-0", className)}
style={{ width: "min(" + grow * 100 + "%, " + size + "px)" }}
>
<div className="relative size-full">
<MoonSphere size={width} moonColor={color} />
</div>
</div>
)
}
function SaveButton() {
const [saved, setSaved] = useState(false)
return (
<Button
variant="outline"
className="h-auto min-h-10 max-w-full py-2.5 text-center whitespace-normal"
aria-pressed={saved}
onClick={() => setSaved(!saved)}
>
{saved ? COPY.saved : COPY.save}
</Button>
)
}
function useWidth(initial: number) {
const ref = useRef<HTMLDivElement>(null)
const [width, setWidth] = useState(initial)
useEffect(() => {
const node = ref.current
if (!node) return
const observer = new ResizeObserver(([entry]) => {
const next = Math.round(entry.contentRect.width)
if (next > 0) setWidth((current) => (current === next ? current : next))
})
observer.observe(node)
return () => observer.disconnect()
}, [])
return { ref, width }
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const eyebrowVariants = cva("text-eyebrow", {
variants: {
/**
* `default` is a 14px/20px label. `icon` adds a row with a 16px icon
* and a 12px gap; put the icon first and give it `aria-hidden`.
* `mono` and `caps` are 12px/20px uppercase labels with 0.12em
* tracking, in the mono and inherited faces respectively.
*/
variant: {
default: "text-sm/5 font-medium text-eyebrow",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium tracking-[0.12em] uppercase",
caps: "text-xs/5 font-medium tracking-[0.12em] uppercase",
},
},
defaultVariants: { variant: "default" },
})
/**
* A short label above a heading, rendered as a `<p>` at weight 500.
* The default is 14px/20px in the kit's eyebrow color. The surrounding
* layout controls the space to the heading. Use `className` to customize
* the typography or color, and `render` to change the element.
*/
function Eyebrow({
className,
variant = "default",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import { cn } from "cn"
/**
* A sphere lit only on one limb, for a moon rising over a dark ground. A
* radial gradient from the lower-left corner runs transparent out to
* `moonColor` at the upper-right edge, so the rest of the disc shows the
* ground behind it. It is decorative and hidden from assistive tech.
*/
function MoonSphere({
className,
size = 256,
moonColor = "oklch(0.65 0.12 55)",
style,
...props
}: React.ComponentProps<"div"> & {
/** Diameter in px. */
size?: number
/** The rim light's color. */
moonColor?: string
}) {
return (
<div
aria-hidden="true"
data-slot="moon-sphere"
className={cn("block rounded-full", className)}
style={{
width: size,
maxWidth: "100%",
background: `radial-gradient(circle at 0% 100%, transparent 60%, ${moonColor} 100%)`,
...style,
height: "auto",
aspectRatio: "1 / 1",
flexShrink: 0,
}}
{...props}
/>
)
}
export { MoonSphere }
Installation
pnpm dlx shadcn@latest add @01orbital/rose-feature-01npx shadcn@latest add @01orbital/rose-feature-01yarn dlx shadcn@latest add @01orbital/rose-feature-01bunx --bun shadcn@latest add @01orbital/rose-feature-01Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/cta/rose-feature-01/index.tsx: change them there, not in the markup. - Its look comes from Moon Sphere; each page lists the props that change it.
Built from
npm: @01orbital/font-geist-serif, cn. The CLI installs them for you.
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.
Last updated on