Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Shape
  3. API and Development

Shape

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Import Shape, ShapeStrokeAlignment, ShapeStrokeLinecap, ShapeStrokeLinejoin, ShapeStrokeWidth, toSvgPathData, and types ShapeLayer and SvgViewBox from @prepared911/ui/shape. Brand path data with toSvgPathData; use type SvgPathData for branded path values.
There is no className, style, or as. Consumers may pass data-* attributes the same way as on Image.
Props
NameTypeDefaultDescription
labelLocalizedMessage—Accessible name; renders role="img" and aria-label.
pathSvgPathData—Branded path data for the d attribute.
viewBoxSvgViewBox—User-space view box; rendered as "minX minY width height".
decorativeboolean—When omitted or false, the shape is meaningful and must supply label. Marks the graphic as decorative. Renders aria-hidden="true" and focusable="false".
fillVectorPaint—Fill paint. Defaults to none when omitted.
idstring—Element id forwarded to the svg.
layersreadonly ShapeLayer[]—Extra paths drawn above the base path, in order, each with its own paint.
refRef<SVGSVGElement>—Ref to the root svg.
sizeShapeSize—Space-scale box for the root svg.
strokeVectorPaint—Stroke paint. Defaults to none when omitted.
strokeAlignmentShapeStrokeAlignmentShapeStrokeAlignment.CenterStroke alignment relative to the path. Inside and Outside are meaningful only for closed paths.
strokeLinecapShapeStrokeLinecapShapeStrokeLinecap.ButtStroke end style of the base path.
strokeLinejoinShapeStrokeLinejoinShapeStrokeLinejoin.MiterStroke corner style of the base path.
strokeWidthShapeStrokeWidthShapeStrokeWidth.HairlineStroke width in viewBox user units.
ShapeStrokeWidth
MemberValue (user units)
Hairline1
Thin2
Regular3
Thick4
ShapeStrokeAlignment
MemberSerialized value
Centercenter
Insideinside
Outsideoutside
ShapeStrokeLinecap
MemberSerialized value
Buttbutt
Roundround
Squaresquare
ShapeStrokeLinejoin
MemberSerialized value
Mitermiter
Roundround
Bevelbevel
ShapeLayer (layers)
PropTypeDescription
pathSvgPathDataBranded path data for the layer.
fillVectorPaintFill paint; none when omitted.
strokeVectorPaintStroke paint; none when omitted.
strokeWidthShapeStrokeWidthStroke width in user units. Defaults to Hairline.
strokeLinecapShapeStrokeLinecapStroke end style. Defaults to Butt.
strokeLinejoinShapeStrokeLinejoinStroke corner style. Defaults to Miter.
ShapeSize
PropTypeDescription
blockSpaceOptionBlock size from the space scale; omitted keeps intrinsic block size.
inlineSpaceOptionInline size from the space scale; omitted keeps intrinsic inline size.
VectorPaint (fill, stroke)
Foreground token (except Inherit) | ChartColor | DataColor. Defaults to none when omitted.
Figma
The Shape component set in the Axon 911 Design System file maps to this component through packages/ui/src/components/shape/shape.figma.ts. The set draws a sample closed path as two layers, Fill and Stroke, and exposes Show fill, Show stroke, Stroke width, Stroke alignment and Size as component properties. Stroke alignment uses Figma's native inside, center and outside stroke placement, and size steps use the space variables. Fill and stroke paint come from each layer's Text Foreground variable mode; ChartColor and DataColor paint, path, viewBox and the accessible name are code-only. See Figma Code Connect.
Storybook
The registry links the root `Default` story. Open the `Shape/Props` and `Shape/Composition` groups in Storybook for stroke width, alignment, paint, label vs decorative, and map marker fixtures.
DefaultOpens in a new tab
Previous
Shape / Usage
Next
Shape / Accessibility
On this page
Props
ShapeStrokeWidth
ShapeStrokeAlignment
ShapeStrokeLinecap
ShapeStrokeLinejoin
ShapeLayer (layers)
ShapeSize
VectorPaint (fill, stroke)
Figma
Storybook