yew-limput

Crates.ioyew-limput
lib.rsyew-limput
version0.4.0
created_at2025-03-22 17:09:39.847843+00
updated_at2025-03-24 20:22:09.467651+00
descriptionA yew component that provides an html input with real-time value filtering
homepage
repositoryhttps://github.com/sbruton/yew-limput
max_upload_size
id1601968
size39,209
Sean Bruton (sbruton)

documentation

README

Filtered Input Fields for Yew

Example Usage

General Text Input Constraints

use std::rc::Rc;
use yew::prelude::*;
use yew_limput::{LimitedTextInput, input_filter};

#[function_component]
fn Example() -> Html {
    let filter = input_filter!(|c: &char| c.is_uppercase());
    html! { <LimitedTextInput {filter} max_len={12} /> }
}

TOTP Code Input

LimitedNumericInput is the same as using LimitedTextInput with the filter |c: &char| c.is_ascii_digit()

use std::rc::Rc;
use yew::prelude::*;
use yew_limput::LimitedNumericInput;

#[function_component]
fn Example() -> Html {
    let on_max_len = Callback::from(|code: String| {
        unimplemented!("totp code processing");
    });

    html! { <LimitedNumericInput class="totp" max_len={6} {on_max_len} /> }
}
Commit count: 17

cargo fmt