Mingot
The Leptos UI library for applications that demand mathematical precision.
Why Mingot?
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:
- u64, u128 precision integers
- Arbitrary-precision decimals via rust_decimal (128-bit, 28-29 significant digits)
- High-precision decimals with configurable decimal places
- Zero precision loss in user input and display
The Problem with Standard UI Libraries
// 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.
The Mingot Solution
// Mingot NumberInput with u64 precision
<NumberInput
precision=U64
label="Transaction ID"
on_valid_change=new
/>
// Arbitrary precision with rust_decimal (requires high-precision feature)
<NumberInput
precision=Arbitrary
label="High-Precision Calculation"
on_valid_change=new
/>
Core Philosophy
Precision First, Everything Else Second
- No Compromises on Accuracy: Every component that handles numeric data supports high-precision mathematics
- Type Safety: Rust's type system prevents precision loss at compile time
- Validation at Input: Real-time validation ensures invalid values never enter your system
- Arbitrary Precision: Optional rust_decimal integration for 128-bit decimal arithmetic
Features
Ultra-Precision Components
- NumberInput: u64, u128, i64, i128, arbitrary-precision number input
- More precision components coming: DateInput with nanosecond precision, financial calculators, scientific notation support
Standard UI Components
Mingot also provides all the components you need for building complete applications:
- Layout: Container, Stack, Group, Grid, AppShell
- Forms: Input, Textarea, Select, Checkbox, Radio, Switch
- Navigation: Navbar, Menu, Breadcrumbs, Tabs
- Feedback: Alert, Banner, Modal, Drawer, Notification
- Data Display: Table, Card, Badge, Avatar, Stats
- Typography: Text with full theming support
Developer Experience
- Type-Safe: Built with Rust for compile-time safety
- Reactive: Leverages Leptos's fine-grained reactivity
- Themeable: Comprehensive theming system inspired by Mantine UI
- Well Documented: Extensive docs with real-world examples
- Tested: Comprehensive test suite with precision-focused tests
Installation
Add Mingot to your Cargo.toml:
[]
= "0.3.0"
= "0.8"
# Optional: Enable arbitrary-precision support with rust_decimal
= { = "0.3.0", = ["high-precision"] }
Quick Start
Basic Application
use *;
use *;
High-Precision Number Input
use *;
use *;
Decimal Precision
<NumberInput
precision=Decimal
label="Volatility"
description="14 decimal places of precision"
allow_decimal=true
min="0"
max="1"
/>
Use Cases
Mingot is built for applications where precision matters:
Financial Applications
- Trading platforms with high-frequency calculations
- Cryptocurrency wallets and exchanges
- Accounting software with exact decimal arithmetic
- Risk modeling and portfolio management
Scientific Computing
- Physical simulations requiring numerical stability
- Statistical analysis with large datasets
- Computational chemistry and physics
- Climate modeling and environmental science
Engineering & CAD
- Computer-aided design with precise measurements
- Structural analysis and finite element methods
- Manufacturing tolerances and specifications
- Aerospace and automotive engineering calculations
Mathematical Software
- Computer algebra systems
- Theorem provers and verification tools
- Educational mathematics platforms
- Research and academic applications
Component Documentation
NumberInput (Precision Component)
The flagship component of Mingot, designed for high-precision numeric input.
Precision Types:
Error Handling:
Full API:
<NumberInput
// Precision configuration
precision=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=Thousand // 1,234,567
decimal_separator='.'
thousand_separator=','
// Standard form props
variant=Default
size=Md
label="Field Label"
description="Helper text"
error="Error message"
placeholder="0"
disabled=false
required=false
/>
Standard Components
For complete documentation of all standard components (Button, Input, Select, etc.), see the full component documentation.
Theming
Mingot includes a comprehensive theming system:
use ;
let custom_theme = Theme ;
view!
Roadmap
Mingot's development is organized around enhancing precision capabilities while maintaining a complete component library.
Phase 1: Foundation ✅ (Current)
- NumberInput with stdlib precision types (u64, u128, i64, i128, decimal)
- Input filtering and validation
- ParseError type system
- Comprehensive test coverage
Phase 2: Amari Integration 🚧 (In Progress)
- Optional
amaridependency via feature flag NumberInputPrecision::Arbitrarymode- Direct Amari type integration
- Callbacks returning parsed
amari::Number
Phase 3: Advanced Precision Features
- Auto-formatting on blur (thousand separators, scientific notation)
- Increment/decrement controls with configurable step
- Copy/paste with format detection
- Keyboard shortcuts for precision input
- Visual precision indicators
Phase 4: Domain-Specific Components
- CurrencyInput: Multi-currency support with exact decimal arithmetic
- ScientificInput: Scientific notation with mantissa/exponent validation
- DateTimeInput: Nanosecond-precision timestamps
- RangeInput: High-precision range selection
- CalculatorInput: Expression evaluation with arbitrary precision
Phase 5: Advanced Mathematics
- MatrixInput: Precision matrix entry and display
- VectorInput: Geometric algebra integration
- GraphInput: Precision coordinate systems
- FormulaInput: Mathematical expression editor with symbolic math
Long-term Vision
- First-class support for geometric algebra via Amari
- Tropical algebra UI components
- Automatic differentiation visualization
- Integration with computational mathematics ecosystems
See ROADMAP.md for detailed timelines and feature specifications.
Architecture
Precision-First Design Principles
- No Silent Precision Loss: Components never silently coerce to lower precision
- Explicit Validation: All precision conversions are explicit and validated
- Type-Safe Boundaries: Rust's type system enforces precision constraints
- User-Visible Errors: Precision errors surface immediately with clear messages
Component Patterns
All Mingot components follow patterns documented in COMPONENT_GUIDELINES.md:
- Concrete
Callback<T>types (not generics) - Comprehensive HTML5 attribute support
- Consistent variant and size enums
- Themeable with StyleBuilder
- Tested with real-world integration
Testing
Mingot includes extensive test coverage with special focus on precision:
# Run all tests
# Run precision-specific tests
# Run with Amari integration (requires feature)
Current test suite:
- 59 passing tests
- 6 NumberInput-specific precision tests
- Overflow/underflow detection
- Decimal place validation
- Input filtering verification
Contributing
Mingot is built for the Industrial Algebra ecosystem but welcomes contributions from anyone building precision-critical applications.
Development Priorities
- Precision Components: New components for high-precision numeric input
- Amari Integration: Deeper integration with Amari's mathematical capabilities
- Domain-Specific Tools: Financial, scientific, and engineering-focused components
- Performance: Optimizing precision operations for real-time applications
Getting Started
# Clone the repository
# Run tests
# Run examples
# Build documentation
Real-World Examples
Cryptocurrency Exchange
// Handling Satoshi values (Bitcoin's smallest unit)
<NumberInput
precision=U64
label="Amount (Satoshis)"
description="1 BTC = 100,000,000 Satoshis"
min="0"
max="2100000000000000" // Total Bitcoin supply in Satoshis
/>
Scientific Simulation
// Physical constants requiring high precision
<NumberInput
precision=Decimal
label="Planck Constant (J⋅s)"
description="6.62607015 × 10⁻³⁴"
allow_scientific=true
/>
Financial Trading
// Stock price with 4 decimal places (standard)
<NumberInput
precision=Decimal
label="Limit Price"
description="USD per share"
min="0"
/>
Performance
Mingot's precision components are optimized for real-time applications:
- Input latency: < 16ms (60 FPS responsive)
- Validation overhead: Minimal (stdlib parsing is fast)
- WASM binary size: Optimized with LTO and opt-level='z'
- Amari integration: Zero-cost when feature disabled
Browser Compatibility
- Desktop: Chrome, Firefox, Safari, Edge (latest 2 versions)
- Mobile: iOS Safari, Chrome Mobile
- WASM: All browsers with WebAssembly support
License
Mingot is dual-licensed under:
- MIT License (LICENSE-MIT)
- Apache License 2.0 (LICENSE-APACHE)
Choose the license that best suits your project.
Acknowledgments
- Mantine UI: API design inspiration
- Leptos: Reactive foundation
- Amari: Arbitrary-precision mathematics
- Industrial Algebra: Primary development and use cases
Links
- Documentation: https://docs.rs/mingot
- Crate: https://crates.io/crates/mingot
- Repository: https://github.com/Industrial-Algebra/Mingot
- Amari: https://github.com/justinelliottcobb/Amari
- Leptos: https://leptos.dev
Built with precision. Built for science.