Blocks
Svg
Shapes (Rect, Circle, Ellipse, Line, Polygon, Path) drawn in a box of its own: its width and height, and the coordinates its viewBox gives them.
import { Svg } from "@hyper-elements/react";Example
- No diagnostics. Nothing to fix, nothing degraded.
<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"></head><body style="margin:0;background-color:#fff"><main style="max-width:520px;margin:0 auto;display:flex;flex-direction:column;gap:16px;overflow-wrap:break-word;color:#0f172a;font-family:Inter, Helvetica, Arial, sans-serif;font-size:16px;font-weight:400;font-style:normal;line-height:1.5;letter-spacing:0;text-align:left;text-transform:none"><div style="display:flex;flex-direction:column;gap:16px;box-sizing:border-box;padding:24px"><svg xmlns="http://www.w3.org/2000/svg" width="240" height="120" viewBox="0 0 240 120" aria-hidden="true" style="align-self:flex-start;display:block;flex:none;background-color:#0f172a;border-radius:12px"><rect x="24" y="70" width="28" height="30" rx="4" fill="#334155"></rect><rect x="64" y="50" width="28" height="50" rx="4" fill="#475569"></rect><rect x="104" y="30" width="28" height="70" rx="4" fill="#64748b"></rect><rect x="144" y="16" width="28" height="84" rx="4" fill="#ef4638"></rect><circle cx="204" cy="40" r="14" fill="#e2e8f0"></circle><path d="M196 40 l6 6 l10 -12" fill="none" stroke="#0f172a" stroke-width="3"></path></svg></div></main></body></html>Show the code
import { Circle, Column, Page, Path, Rect, Svg } from "@hyper-elements/react";
export default function Example() {
return (
<Page width={520} style={{ backgroundColor: "#ffffff", fontFamily: "Inter, Helvetica, Arial, sans-serif", color: "#0f172a", gap: 16 }}>
<Column style={{ padding: 24, gap: 16 }}>
<Svg width={240} height={120} viewBox="0 0 240 120" style={{ backgroundColor: "#0f172a", borderRadius: 12 }}>
<Rect x={24} y={70} width={28} height={30} rx={4} style={{ fill: "#334155" }} />
<Rect x={64} y={50} width={28} height={50} rx={4} style={{ fill: "#475569" }} />
<Rect x={104} y={30} width={28} height={70} rx={4} style={{ fill: "#64748b" }} />
<Rect x={144} y={16} width={28} height={84} rx={4} style={{ fill: "#ef4638" }} />
<Circle cx={204} cy={40} r={14} style={{ fill: "#e2e8f0" }} />
<Path d="M196 40 l6 6 l10 -12" style={{ stroke: "#0f172a", strokeWidth: 3, fill: "transparent" }} />
</Svg>
</Column>
</Page>
);
}Reference
Shapes (Rect, Circle, Ellipse, Line, Polygon, Path) drawn in a box of its own: its width and height, and the coordinates its viewBox gives them.
Holds: Rect, Circle, Ellipse, Line, Polygon, Path. Drawn in: page.
Props:
width: a number from 0 (required)height: a number from 0 (required)viewBox: text. The shapes’ coordinates in it, as “x y width height” (its width and height by default).title: text. What it shows, read out by screen readers.
style:
padding: insetsbackgroundColor: colorborder: borderborderRadius: radiusflex: flex. In a Row: its share of the width left after children with a width (default 1); “none” takes its own size.
mobile (on phones): padding, border.