Shapes are vector primitives that fill their frame.Documentation Index
Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
Use this file to discover all available pages before exploring further.
Rectangle and RoundedRectangle are sharp- and rounded-corner rectangles; Capsule is a rounded rectangle with maximum corner radius. Circle and Ellipse are radial primitives. Path builds an arbitrary vector shape from drawing commands.
Every shape supports .fill(style) to paint its interior and .stroke(style) to draw its outline. Shapes also work as .clipShape(), .background(), or .overlay() arguments for other components.
Rectangle
A rectangle shape that fills its frame.Fills the rectangle interior with a color, gradient, or other style.
Draws the rectangle outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.For rounded corners, use RoundedRectangle or the
.cornerRadius() modifier.RoundedRectangle
A rectangle with rounded corners.Configuration options for the rounded rectangle.
Fills the rounded rectangle interior with a color, gradient, or other style.
Draws the rounded rectangle outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.For fully rounded ends (pill shape), use Capsule instead of computing the corner radius manually. RoundedRectangle can also be used with
.clipShape() and .contentShape() modifiers.Circle
A circle shape centered in its frame.Fills the circle interior with a color, gradient, or other style.
Draws the circle outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.Ellipse
An ellipse shape that fills its frame.Fills the ellipse interior with a color, gradient, or other style.
Draws the ellipse outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.When the frame is square, Ellipse renders identically to Circle.
Capsule
A capsule shape — a rounded rectangle with maximum corner radius.Fills the capsule interior with a color, gradient, or other style.
Draws the capsule outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.When the frame is square, Capsule renders as a circle. Use Circle directly if a circle is always intended. For a rounded rectangle with a specific corner radius, use RoundedRectangle instead.
Path
Creates a custom vector shape from path drawing commands.A function that receives a PathBuilder and uses its drawing commands to construct the shape.
path parameter provides the following drawing commands:
Begins a new subpath at the given point.
Adds a straight line from the current point to the given point.
path.quadCurve(x, y, controlX, controlY)
(x: number, y: number, controlX: number, controlY: number) => void
Adds a quadratic Bezier curve to the given point with one control point.
path.curve(x, y, control1X, control1Y, control2X, control2Y)
(x: number, y: number, control1X: number, control1Y: number, control2X: number, control2Y: number) => void
Adds a cubic Bezier curve to the given point with two control points.
path.arc(props)
(props: { centerX: number; centerY: number; radius: number; startAngle: number; endAngle: number; clockwise?: boolean }) => void
Adds an arc. Angles are specified in degrees.
Adds a rectangle subpath.
path.addRoundedRect(props)
(props: { x: number; y: number; width: number; height: number; cornerWidth: number; cornerHeight: number }) => void
Adds a rounded rectangle subpath.
Adds an ellipse subpath inscribed in the given rectangle.
Adds a polyline from an array of
[x, y] coordinate pairs.Closes the current subpath by drawing a line back to the starting point.
Fills the path interior with a color, gradient, or other style.
Draws the path outline. Pass a Style for a 1-point stroke, or a StrokeOptions object (
{ style: Style, lineWidth?: number }) for custom width.Coordinates are relative to the Path’s own coordinate space — use
.frame() to set the overall size. Path returns a Shape, so it can be used anywhere shapes are accepted, including .clipShape(), .background(), and .overlay(). Multiple subpaths can be created by calling move() multiple times within a single builder.See also
- LinearGradient — gradient fills for shapes
- Color — solid color fills and strokes
- Image — bitmap content to clip with shapes
- ZStack — layer shapes behind or in front of content