# <layer>

Declares one layer of a drawing surface: a locked picture to trace over, and a layer to paint on.

Category: Media.

```ham
<draw id="canvas"
      layer="paint"
      toolbar="false"
      style="w-full aspect-4/3 rounded-xl">
    <layer id="photo"
           name="Photo"
           src="https://hypeapps.dev/gallery/assets/landscape.jpg"
           locked="true"
           opacity="0.5"/>
    <layer id="paint"
           name="Paint"/>
</draw>
```

How Hype Apps draws it on a phone: [light](https://hypeapps.dev/img/tags/layer-light.webp), [dark](https://hypeapps.dev/img/tags/layer-dark.webp).

## Attributes

| Name | What it does | Default |
|---|---|---|
| `blend` | How the layer composites over the ones below. (normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity, add) | `normal` |
| `id` | The layer's id: #id.layer:paint, #id.layer.paint.hide, $id.layer.paint.visible, $id.layer_id; a word, never all digits (that is a layer number). |  |
| `locked` | Takes no stroke, eraser or fill and cannot be the active layer (a fill still sees it). | `false` |
| `name` | The layer's name as shown ($id.layer_name, $id.layer.paint.name); the id when there is none. With no id, the name serves as the id. |  |
| `opacity` | Layer opacity 0–1. | `1` |
| `position` | Place the layer at the top or the bottom of the stack regardless of where it is written. (top, bottom) |  |
| `src` | Image loaded into the layer as its base (line art, a photo); exported with the drawing. |  |
| `visible` | false starts the layer hidden. | `true` |

Any tag also takes gestures: `@on.tap`, `@on.longpress`, `@on.doubletap` and `@on.swipeleft` (and right, up and down). `@click` runs on a tap too.

## Related tags

- [`<audio>`](https://hypeapps.dev/docs/reference/audio.md): A compact audio player bar with play, a progress track and the track's title and artist.
- [`<camera>`](https://hypeapps.dev/docs/reference/camera.md): A live camera viewfinder with a shutter; the photo's path goes into a variable.
- [`<canvas>`](https://hypeapps.dev/docs/reference/canvas.md): A drawing surface for finger or stylus, with a pen, eraser and color toolbar; it saves as a PNG.
- [`<file-picker>`](https://hypeapps.dev/docs/reference/file-picker.md): Opens the device's photo, video or file picker (or the camera) and puts the chosen file in a variable.
- [`<img>`](https://hypeapps.dev/docs/reference/img.md): Shows a picture from a URL or the app's files, sized and cropped by its style.
- [`<lottie>`](https://hypeapps.dev/docs/reference/lottie.md): Plays a Lottie vector animation from a JSON file; taps and media commands control it.
- [`<map>`](https://hypeapps.dev/docs/reference/map.md): An OpenStreetMap map you can pan and zoom, centered on a place, with pins on it.
- [`<mic>`](https://hypeapps.dev/docs/reference/mic.md): A voice recorder with a record button, a live waveform, a timer and playback of the last take.

All tags: https://hypeapps.dev/docs/reference.md · The full reference: https://hypeapps.dev/llms.txt
