https://github.com/togglebyte/anathema-extras
https://github.com/togglebyte/anathema-extras
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/togglebyte/anathema-extras
- Owner: togglebyte
- Created: 2025-06-17T19:56:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-21T09:27:20.000Z (about 1 year ago)
- Last Synced: 2025-10-28T04:29:39.407Z (9 months ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Anathema extras
This crate contains third party components for Anathema.
# Input
A single line input field.
```rust
builder
.default::("input", Input::template())
.unwrap();
```
The input component can be registered as a prototype as well.
```rust
builder
.prototype("input", Input::template(), Input::new, InputState::new)
.unwrap();
```
## Supported events:
The following events are provided:
### `on_enter`
The enter key was pressed.
This event publishes `anathema_extras::Text`, which implements `Deref`.
### `on_change`
A change was made to the text (insert or remove).
This event publishes `anathema_extras::InputChange`.
### `on_focus`
The input component gained focus.
This event publishes `()`.
### `on_blur`
The input component lost focus.
This event publishes `()`.
## Attributes
### `clear_on_enter`
If the desired outcome is to retain the text when the enter key is pressed set
this attribute to false.
```
@input [clear_on_enter: false]
```
## Example
```
vstack
@input (on_enter->update_label_a)
@input (on_enter->update_label_b)
```