embedded-graphics-keyboard
no_std on-screen keyboard and text field widgets for
embedded-graphics, driven by
navigation buttons and/or a touch screen.

Features
- QWERTY layout with a digits and symbols page, Shift (one-shot, double press for caps lock) and Space, Backspace, Back and Enter keys.
- Custom layouts: any number of pages, rows and keys, defined in
consts. - Fits any screen: every letter key has the same size, computed from the
given bounds; the bottom action row spans the full width.
Keyboard::keys_boundsreturns the area really covered by the keys, to align other widgets on them. - 5-button navigation (
Up,Down,Left,Right,Validate) and touch input, both usable at the same time. - Text field with a title above its frame, a blinking cursor and horizontal scrolling of long values.
- Fully styleable: one
KeyStyle(background, border, corner radius and font) per key state,FrameStylefor the frames. Icons through an icon font. - Font agnostic: works with
MonoTextStyle, and withembedded-graphics-glyphixfonts behind theglyphixfeature. ImplementFontStylefor anything else. - Checked up front:
Keyboard::newfails if a label does not fit inside its key, instead of drawing garbage. - Partial redraw:
Keyboard::redrawonly sends the keys that changed (usually two) to the display, which matters on SPI/I2C screens. - No allocation, no
unsafe.
| Digits & symbols | Caps lock, light theme |
|---|---|
![]() |
![]() |
| 800x480, framed keyboard, outlined keys | 320x240 |
|---|---|
![]() |
![]() |
Usage
[]
= "0.1"
use ;
use ;
See examples/simulator.rs for a complete interactive
demo, and examples/screenshots.rs for the
configurations shown above.
The examples need SDL2 (libsdl2-dev on Debian/Ubuntu).
For real hardware, examples/stm32f767zi runs the
keyboard on a NUCLEO-F767ZI with an ILI9488 SPI display (mipidsi, Embassy)
and five push buttons.
Custom layouts
use ;
const KEYPAD: Layout = new;
Pass it with KeyboardConfig::with_layout, and change the control key labels
with KeyboardConfig::with_labels.
Cargo features
glyphix:FontStyleimplementation forembedded_graphics_glyphix::GlyphixStyle.
Minimum supported Rust version
Rust 1.85 (edition 2024).
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.



