#yew #text-input #html #yew-component #real-time #filtering #limput

yew-limput

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

3 unstable releases

Uses new Rust 2024

new 0.2.1 Mar 22, 2025
0.2.0 Mar 22, 2025
0.1.0 Mar 22, 2025

#291 in GUI

MIT/Apache

10KB
110 lines

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

Dependencies

~11–20MB
~265K SLoC