A Rust crate for cooking up terminal user interfaces (TUIs) 👨‍🍳🐀 https://ratatui.rs https://ratatui.rs
Find a file
Nikolaus Schuetz 3d8639cbb2
docs(core): clarify Rect::contains half-open bounds (#2671)
## Description

`Rect::contains` documents that a position is inside "if it is on the
`Rect`'s border", but a `Rect` covers the half-open range `x..right()`
by `y..bottom()` — the top and left edges are inside, the right and
bottom edges are not. The `outside_right` and `outside_bottom` test
cases already lock in that exclusive behavior, so the "border" wording
is misleading.

This updates the doc comment to describe the actual bounds and adds an
example showing the excluded right edge. No behavior change.

## Testing

The doc example is a doctest; `cargo test --doc -p ratatui-core
contains` passes.

---

This PR was drafted with the help of Claude Code (per the project's note
on AI-assisted contributions); I've reviewed and verified the change.
2026-07-25 14:58:52 -07:00
.cargo chore(ci): replace cargo-make with a custom cargo-xtask (#1461) 2024-11-02 10:03:44 +03:00
.github build(deps): bump taiki-e/install-action from 2.83.2 to 2.84.0 (#2657) 2026-07-21 23:21:05 +03:00
.vscode chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
assets docs(ratatui): update the changelog for v0.30.1 (#2568) 2026-06-05 11:50:12 +03:00
examples build(deps): bump octocrab from 0.53.1 to 0.54.0 (#2643) 2026-07-15 09:27:58 -07:00
ratatui fix(ci): restore docs and advisory checks (#2648) 2026-07-15 16:58:44 +03:00
ratatui-core docs(core): clarify Rect::contains half-open bounds (#2671) 2026-07-25 14:58:52 -07:00
ratatui-crossterm build(deps): bump taiki-e/install-action from 2.82.2 to 2.82.7 (#2623) 2026-07-02 18:24:46 +03:00
ratatui-macros build(deps): bump taiki-e/install-action from 2.82.2 to 2.82.7 (#2623) 2026-07-02 18:24:46 +03:00
ratatui-termina build(deps): bump taiki-e/install-action from 2.82.2 to 2.82.7 (#2623) 2026-07-02 18:24:46 +03:00
ratatui-termion build(deps): bump taiki-e/install-action from 2.82.2 to 2.82.7 (#2623) 2026-07-02 18:24:46 +03:00
ratatui-termwiz build(deps): bump taiki-e/install-action from 2.82.2 to 2.82.7 (#2623) 2026-07-02 18:24:46 +03:00
ratatui-widgets fix(ci): restore docs and advisory checks (#2648) 2026-07-15 16:58:44 +03:00
xtask chore(ci): pin nightly toolchain for cargo-udeps (#2665) 2026-07-21 00:15:07 +03:00
.cliffignore chore: release beta (#2162) 2025-11-01 02:22:55 +03:00
.cz.toml ci: refactor xtask / toml formatting (#1602) 2025-01-14 14:20:05 -08:00
.editorconfig chore(editorconfig): set and apply some defaults (#974) 2024-03-03 21:41:19 -08:00
.gitignore chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
.markdownlint.yaml feat(examples): add demo2 example (#500) 2023-09-21 01:47:23 -07:00
ARCHITECTURE.md feat: add Termina backend (#2561) 2026-06-12 22:56:52 -07:00
bacon.toml ci: audit github workflows with zizmor (#1961) 2025-07-02 14:51:41 -07:00
BREAKING-CHANGES.md docs(ratatui): update the changelog for v0.30.1 (#2568) 2026-06-05 11:50:12 +03:00
Cargo.lock build(deps): bump serde_json from 1.0.150 to 1.0.151 (#2661) 2026-07-20 21:41:04 +00:00
Cargo.toml build(deps): bump octocrab from 0.53.1 to 0.54.0 (#2643) 2026-07-15 09:27:58 -07:00
CHANGELOG.md docs(changelog): update changelog for 0.30.2 (#2608) 2026-06-19 11:45:44 +03:00
cliff.toml chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
clippy.toml chore(build): remove cargo lint (#1549) 2024-12-05 21:35:06 +03:00
CODE_OF_CONDUCT.md chore(markdown): fix linting issues reported by xtask lint (#2435) 2026-03-13 21:40:34 +03:00
codecov.yml ci(codecov): adjust threshold and noise settings (#615) 2023-11-05 10:21:11 +01:00
committed.toml style(config): apply formatting to config files (#238) 2023-06-11 20:26:45 +00:00
CONTRIBUTING.md chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
deny.toml chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
FUNDING.json chore(funding): add eth address for receiving funds from drips.network (#994) 2024-03-27 18:11:26 +03:00
LICENSE docs(license): update copyright years (#1639) 2025-02-04 11:18:02 +03:00
MAINTAINERS.md chore: update maintainers (#2122) 2025-10-05 12:07:06 -07:00
README.md docs: use shields.io badge (#2040) 2025-08-04 17:32:32 -07:00
release-plz.toml chore: remove @ sign from github release and PR (#2353) 2026-01-17 12:10:59 +03:00
RELEASE.md docs(release): fix typo (#1754) 2025-04-03 21:51:03 +03:00
rust-toolchain.toml chore: Create rust-toolchain.toml (#415) 2023-08-19 03:51:53 +00:00
rustfmt.toml chore: document rustfmt options (#2055) 2025-09-01 18:48:09 +03:00
SECURITY.md chore: rename ratatui-org to ratatui (#1334) 2024-08-21 11:35:08 -07:00
tombi.toml chore(toml): migrate from taplo to tombi (#2501) 2026-06-05 00:42:45 +03:00
typos.toml docs(ratatui): update the changelog for v0.30.1 (#2568) 2026-06-05 11:50:12 +03:00

Table of Contents

Release header

Ratatui (ˌræ.təˈtu.i) is a Rust crate for cooking up terminal user interfaces (TUIs). It provides a simple and flexible way to create text-based user interfaces in the terminal, which can be used for command-line applications, dashboards, and other interactive console programs.

Quickstart

Ratatui has templates available to help you get started quickly. You can use the cargo-generate command to create a new project with Ratatui:

cargo install --locked cargo-generate
cargo generate ratatui/templates

Selecting the Hello World template produces the following application:

use color_eyre::Result;
use crossterm::event::{self, Event};
use ratatui::{DefaultTerminal, Frame};

fn main() -> Result<()> {
    color_eyre::install()?;
    let terminal = ratatui::init();
    let result = run(terminal);
    ratatui::restore();
    result
}

fn run(mut terminal: DefaultTerminal) -> Result<()> {
    loop {
        terminal.draw(render)?;
        if matches!(event::read()?, Event::Key(_)) {
            break Ok(());
        }
    }
}

fn render(frame: &mut Frame) {
    frame.render_widget("hello world", frame.area());
}

Documentation

You can also watch the EuroRust 2024 talk to learn about common concepts in Ratatui and what's possible to build with it.

Templates

If you're looking to get started quickly, you can use one of the available templates from the templates repository using cargo-generate:

cargo generate ratatui/templates

Built with Ratatui

Awesome

Check out the showcase section of the website, or the awesome-ratatui repository for a curated list of awesome apps and libraries built with Ratatui!

Alternatives

  • Cursive - a ncurses-based TUI library.
  • iocraft - a declarative TUI library.

Contributing

Discord Badge Matrix Badge Forum Badge

Feel free to join our Discord server for discussions and questions! There is also a Matrix bridge available at #ratatui:matrix.org. We have also recently launched the Ratatui Forum.

We rely on GitHub for bugs and feature requests.

Please make sure you read the contributing guidelines before creating a pull request. We accept AI generated code, but please read the AI Contributions guidelines to ensure compliance.

If you'd like to show your support, you can add the Ratatui badge to your project's README:

[![Built With Ratatui](https://img.shields.io/badge/Built_With_Ratatui-000?logo=ratatui&logoColor=fff)](https://ratatui.rs/)

Built With Ratatui

Acknowledgements

Ratatui was forked from the tui-rs crate in 2023 in order to continue its development. None of this could be possible without Florian Dehau who originally created tui-rs which inspired many Rust TUIs.

Special thanks to Pavel Fomchenkov for his work in designing an awesome logo for the Ratatui project and organization.

License

This project is licensed under the MIT License.