- Getting Started
- The Basics
- Concepts
- SuperNative
-
EDGE Components
- Introduction
- Activity Indicator
- Badge
- Bottom Navigation
- Bottom Sheet
- Button
- Button Group
- Canvas
- Carousel
- Checkbox
- Chip
- Column
- Divider
- Gesture Area
- Icon
- Icons
- Image
- Layout & Styling
- List
- Menus
- Modal
- Pressable
- Progress Bar
- Radio Group
- Row
- Scroll View
- Select
- Shapes
- Side Navigation
- Slider
- Spacer
- Stack
- Tab Row
- Text
- Text Input
- Toggle
- Top Bar
- Virtual List
- Web View
- Plugins
- Testing
- Architecture
You're viewing pre-release documentation — version 4.x is in beta
Features, APIs and behaviour may change before the stable release. View the stable version (3.x)
Canvas
Overview#
A drawing surface for shape primitives. Behaves like a <native:column> for layout purposes —
children stack vertically by default. Use it as a semantic wrapper when grouping shapes.
<native:canvas :width="200" :height="200"> <native:rect :width="100" :height="100" bg="#3B82F6" :border-radius="8" /> <native:circle :width="50" :height="50" bg="#EF4444" /></native:canvas>
Props#
All shared layout and style attributes are supported. There are no canvas-specific props.
Children#
Accepts any EDGE elements as children. Typically used with shape primitives (<native:rect>,
<native:circle>, <native:line>).
For overlay-style layering of shapes use a <native:stack> instead — <native:canvas> arranges children
along the column main axis, which is rarely what you want for free-form drawing.
Element#
use Native\Mobile\Edge\Elements\Canvas;use Native\Mobile\Edge\Elements\Rect; Canvas::make( Rect::make()->width(100)->height(100)->bg('#3B82F6'),);
make(Element ...$children)- Create a canvas with children
in no time