yew-limput 0.2.0

A yew component that provides an html input with real-time value filtering
Documentation

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} /> }
}