vivi_ui 0.2.0

Custom component library for Slint
Documentation
<!--
SPDX-FileCopyrightText: 2024 vivi developers <vivi-ui@tuta.io>
SPDX-License-Identifier: MIT
-->

# `StateLayer`

The `StateLayer` can be used to create custom widget with a state indication like `pressed` or `hovered`. The state layer should be placed between the background and the content of the widget.

### Properties

- **`border_radius`** (_in_ _length_): Defines the size of the radius. (default value: 0)
- **`pressed`** (_in_ _bool_): Set to `true` to display the state layer in the pressed state. (default value: false)
- **`has_hover`** (_in_ _bool_): Set to `true` to display the state layer in the hovered state. (default value: false)
- **`has_focus`** (_in_ _bool_): Set to `true` to display the state layer in the focused state. (default value: false)
- **`has_error`** (_in_ _bool_): Set to `true` to display the state layer in the error state. (default value: false)
- **`focus_padding`** (_in_ _length_): Defines the padding of the focus border (default value: 2px)

### Example

```slint
import { StateLayer } from "@vivi/magic.slint";

export component MyWidget inherits Rectangle {
    width: 60px;
    height: 20px;
    background: green;

    touch_area := TouchArea {}

    StateLayer {
        pressed: touch_area.pressed;
        has_hover: touch_area.has_hover;
    }
}

export component Example inherits Window {
    width: 200px;
    height: 100px;

    MyWidget {}
}
```