https://github.com/akarpovskii/tuile
A cross-platform Text UI (TUI) library in Zig
https://github.com/akarpovskii/tuile
ncurses terminal tui zig zig-package
Last synced: about 1 month ago
JSON representation
A cross-platform Text UI (TUI) library in Zig
- Host: GitHub
- URL: https://github.com/akarpovskii/tuile
- Owner: akarpovskii
- License: mit
- Created: 2024-04-29T18:32:20.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T03:52:05.000Z (over 1 year ago)
- Last Synced: 2024-10-28T07:14:39.077Z (over 1 year ago)
- Topics: ncurses, terminal, tui, zig, zig-package
- Language: Zig
- Homepage:
- Size: 2.16 MB
- Stars: 140
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - akarpovskii/tuile - A cross-platform Text UI (TUI) library in Zig (<a name="Zig"></a>Zig)
README
Tuile
A Text User Interface library for Zig.
Breaking changes are possible.
Explore the docs »
View Examples
·
Report Bug
·
Request Feature
Table of Contents
-
About The Project
-
Getting Started
- Usage
- Cross-compilation
- Roadmap
- Contributing
- License
- Contact
- Acknowledgments
## About The Project
Tuile is a Text User Interface library written in Zig.
Tuile uses [`crossterm`](docs/Backends.md#crossterm) backend by default which works on all UNIX and Windows terminals and supports cross-compilation (powered by [`build.crab`](https://github.com/akarpovskii/build.crab)).
See [`Backends`](docs/Backends.md) for the list of supported backends, or file a [feature request](https://github.com/akarpovskii/tuile/issues/new?labels=enhancement&template=feature-request.md) if you want to have another one added.

Checkout the other examples [here](./examples/).
## Getting Started
### Prerequisites
* Zig 0.12.0+
* Non-default [`backends`](docs/Backends.md) may have additional requirements.
### Installation
1. Add dependency to your `build.zig.zon`
```sh
zig fetch --save https://github.com/akarpovskii/tuile/archive/refs/tags/v0.1.3.tar.gz
```
2. Import Tuile in `build.zig`:
```zig
const tuile = b.dependency("tuile", .{});
exe.root_module.addImport("tuile", tuile.module("tuile"));
```
## Usage
```zig
const tuile = @import("tuile");
pub fn main() !void {
var tui = try tuile.Tuile.init(.{});
defer tui.deinit();
try tui.add(
tuile.block(
.{
.border = tuile.Border.all(),
.border_type = .rounded,
.layout = .{ .flex = 1 },
},
tuile.label(.{ .text = "Hello World!" }),
),
);
try tui.run();
}
```
You can find more examples in the [examples folder](./examples/)
## Cross-compilation
To compile an application that uses Tuile for another target, just add `-Dtarget=` when building your app and make sure to forward it to Tuile:
#### **`build.zig`**
```zig
const target = b.standardTargetOptions(.{});
const tuile = b.dependency("tuile", .{
.target = target
});
```
## Roadmap
In no particular order:
- [ ] Documentation
- [ ] Grid layout
- [ ] Windows and dialogs
- [ ] Menu bar
- [ ] More widgets
See the [open issues][issues-url] for a full list of proposed features (and known issues).
## Contributing
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/amazing-feature`)
3. Commit your Changes (`git commit -m 'Add some Amazing Feature'`)
4. Push to the Branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## License
Distributed under the MIT License. See [`LICENSE`][license-url] for more information.
## Acknowledgments
* [Best-README-Template](https://github.com/othneildrew/Best-README-Template)
[contributors-shield]: https://img.shields.io/github/contributors/akarpovskii/tuile.svg?style=for-the-badge
[contributors-url]: https://github.com/akarpovskii/tuile/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/akarpovskii/tuile.svg?style=for-the-badge
[forks-url]: https://github.com/akarpovskii/tuile/network/members
[stars-shield]: https://img.shields.io/github/stars/akarpovskii/tuile.svg?style=for-the-badge
[stars-url]: https://github.com/akarpovskii/tuile/stargazers
[issues-shield]: https://img.shields.io/github/issues/akarpovskii/tuile.svg?style=for-the-badge
[issues-url]: https://github.com/akarpovskii/tuile/issues
[license-shield]: https://img.shields.io/github/license/akarpovskii/tuile.svg?style=for-the-badge
[license-url]: https://github.com/akarpovskii/tuile/blob/master/LICENSE.txt
[examples-url]: https://github.com/akarpovskii/tuile/tree/main/examples
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/akarpovskii
[product-screenshot]: images/screenshot.png