| Crates.io | mingot |
| lib.rs | mingot |
| version | 0.6.0 |
| created_at | 2026-01-01 00:16:49.968472+00 |
| updated_at | 2026-01-12 21:31:51.467682+00 |
| description | Leptos UI library for applications demanding mathematical precision - u64+ integers, arbitrary-precision decimals, zero precision loss |
| homepage | |
| repository | https://github.com/Industrial-Algebra/Mingot |
| max_upload_size | |
| id | 2015534 |
| size | 931,388 |
The Leptos UI library for applications that demand mathematical precision.
Most web UI libraries are built for consumer applications where precision stops at JavaScript's Number type (safe integers up to 2^53 - 1). Mingot is different.
Built for scientific computing, financial applications, and mathematical software, Mingot provides first-class support for:
// JavaScript Number precision limits
9007199254740992 + 1 // 9007199254740992 (WRONG!)
0.1 + 0.2 // 0.30000000000000004 (WRONG!)
HTML5 <input type="number"> inherits these limitations, making standard UI libraries unsuitable for applications requiring mathematical rigor.
// Mingot NumberInput with u64 precision
<NumberInput
precision=NumberInputPrecision::U64
label="Transaction ID"
on_valid_change=Callback::new(move |result| {
// result: Result<String, ParseError>
// Supports values up to 18,446,744,073,709,551,615
})
/>
// Arbitrary precision with rust_decimal (requires high-precision feature)
<NumberInput
precision=NumberInputPrecision::Arbitrary
label="High-Precision Calculation"
on_valid_change=Callback::new(move |result: Result<String, ParseError>| {
// Up to 28-29 significant digits with exact decimal arithmetic
})
/>
Precision First, Everything Else Second
Mingot also provides all the components you need for building complete applications:
Add Mingot to your Cargo.toml:
[dependencies]
mingot = "0.6.0"
leptos = "0.8"
# Optional: Enable arbitrary-precision support with rust_decimal
mingot = { version = "0.6.0", features = ["high-precision"] }
use leptos::prelude::*;
use mingot::prelude::*;
#[component]
fn App() -> impl IntoView {
view! {
<MingotProvider>
<Container>
<Stack spacing="md">
<Text size=TextSize::Xl weight=TextWeight::Bold>
"Welcome to Mingot"
</Text>
<Button variant=ButtonVariant::Filled>
"Click me"
</Button>
</Stack>
</Container>
</MingotProvider>
}
}
use leptos::prelude::*;
use mingot::prelude::*;
#[component]
fn PrecisionDemo() -> impl IntoView {
let (value, set_value) = create_signal(None::<u64>);
let (error, set_error) = create_signal(None::<String>);
view! {
<NumberInput
precision=NumberInputPrecision::U64
label="Enter a large integer"
description="Supports values up to 18,446,744,073,709,551,615"
on_valid_change=Callback::new(move |result: Result<String, ParseError>| {
match result {
Ok(val) => {
if let Ok(num) = val.parse::<u64>() {
set_value.set(Some(num));
set_error.set(None);
}
}
Err(e) => {
set_error.set(Some(e.to_string()));
}
}
})
/>
{move || value.get().map(|v| view! {
<Text>"Parsed value: " {v.to_string()}</Text>
})}
{move || error.get().map(|e| view! {
<Text color="red">{e}</Text>
})}
}
}
<NumberInput
precision=NumberInputPrecision::Decimal(14)
label="Volatility"
description="14 decimal places of precision"
allow_decimal=true
min="0"
max="1"
/>
Mingot is built for applications where precision matters:
The flagship component of Mingot, designed for high-precision numeric input.
Precision Types:
pub enum NumberInputPrecision {
U64, // Unsigned 64-bit (0 to 18,446,744,073,709,551,615)
U128, // Unsigned 128-bit (massive range)
I64, // Signed 64-bit
I128, // Signed 128-bit
Decimal(u32), // Fixed decimal places (e.g., Decimal(8) for financial)
Arbitrary, // Unlimited precision with Amari (requires feature)
}
Error Handling:
pub enum ParseError {
InvalidFormat(String),
Overflow(String),
Underflow(String),
TooManyDecimals(u32),
NegativeNotAllowed,
DecimalNotAllowed,
}
Full API:
<NumberInput
// Precision configuration
precision=NumberInputPrecision::U64
min="0"
max="1000000"
// Value handling
value=number_value // RwSignal<String>
on_change=on_raw_change // Callback<String>
on_valid_change=on_validated // Callback<Result<String, ParseError>>
// Validation
allow_negative=false
allow_decimal=false
allow_scientific=false
// Display (coming in Phase 2/3)
format=NumberInputFormat::Thousand // 1,234,567
decimal_separator='.'
thousand_separator=','
// Standard form props
variant=InputVariant::Default
size=InputSize::Md
label="Field Label"
description="Helper text"
error="Error message"
placeholder="0"
disabled=false
required=false
/>
For complete documentation of all standard components (Button, Input, Select, etc.), see the full component documentation.
Mingot includes a comprehensive theming system:
use mingot::{MingotProvider, Theme, ColorSchemeMode};
let custom_theme = Theme {
color_scheme: ColorSchemeMode::Dark,
primary_color: "blue",
// ... customize colors, spacing, typography, etc.
..Default::default()
};
view! {
<MingotProvider theme=Some(custom_theme)>
// Your app
</MingotProvider>
}
Mingot's development is organized around enhancing precision capabilities while maintaining a complete component library.
rust_decimal dependency via feature flagNumberInputPrecision::Arbitrary mode (128-bit, 28-29 significant digits)See ROADMAP.md for detailed feature specifications.
All Mingot components follow patterns documented in COMPONENT_GUIDELINES.md:
Callback<T> types (not generics)Mingot includes extensive test coverage with special focus on precision:
# Run all tests
cargo test
# Run precision-specific tests
cargo test number_input
# Run with Amari integration (requires feature)
cargo test --features high-precision
Current test suite:
Mingot is built for the Industrial Algebra ecosystem but welcomes contributions from anyone building precision-critical applications.
# Clone the repository
git clone https://github.com/Industrial-Algebra/Mingot.git
cd Mingot
# Run tests
cargo test
# Run examples
cargo run --example precision_demo
# Build documentation
cargo doc --open
// Handling Satoshi values (Bitcoin's smallest unit)
<NumberInput
precision=NumberInputPrecision::U64
label="Amount (Satoshis)"
description="1 BTC = 100,000,000 Satoshis"
min="0"
max="2100000000000000" // Total Bitcoin supply in Satoshis
/>
// Physical constants requiring high precision
<NumberInput
precision=NumberInputPrecision::Decimal(20)
label="Planck Constant (J⋅s)"
description="6.62607015 × 10⁻³⁴"
allow_scientific=true
/>
// Stock price with 4 decimal places (standard)
<NumberInput
precision=NumberInputPrecision::Decimal(4)
label="Limit Price"
description="USD per share"
min="0"
/>
Mingot's precision components are optimized for real-time applications:
Mingot is dual-licensed under:
Choose the license that best suits your project.
Built with precision. Built for science.