• Stars
    star
    87
  • Rank 378,873 (Top 8 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A place where Druid widgets come to mature before moving to the Druid repo.

druid-widget-nursery

Rust

This repo contains (or, at the time of writing, will contain) widgets that work with druid. The repo follows a policy of optimistic merging, and the idea is that having a lower barrier to merging PRs hopefully leads to a nice contributor experience, which then encourages more people to become regular collaborators for the whole druid family of crates.

We don't insist that all widgets always build when updating to a newer version of druid, and so as you'll see the CI is allowed to fail. Fixing these build failures will often be a good opportunity for a first contribution, and people will always be willing to help out with this work either here or on zulip.

So, in summary, the default assumption for PRs to this repo will be to merge, but this policy includes future PRs that might change or reverse stuff in previous PRs. For more information I recommend reading the optimistic merging article linked here and above, which offers an interesting approach to managing open source projects irrespective of its use here.

Note that for CI we use cargo clippy --all-targets --all-features

Using this library

Add the following to your Cargo.toml. You will need to get the current druid rev from this repository's Cargo.toml.

druid-widget-nursery = { git = "https://github.com/linebender/druid-widget-nursery" }

[patch.'https://github.com/linebender/druid'.druid]
git = "https://github.com/linebender/druid"
rev = "<copy the current druid rev from this repository's Cargo.toml>"

The rev in your Cargo.toml should match the rev under [dependencies.druid] in this repo's Cargo.toml. This ensures that your app depends on the same version of druid as this library - otherwise you may end up with problems with multiple versions of druid installed. For more on the override syntax above, see Cargo's patch documentation.

Once you have druid-widget-nursery installed, you can import the various widgets as usual with use druid_widget_nursery::YourWidgetNameHere. For specific examples of using the various widgets, check out the examples directory.

Widgets

If you add a new widget, please add its name and a short summary here.

  • A tree widget

    Tree example

  • A Navigator widget that can display different child widgets/views.

  • Dropdown : a basic dropdown widget using the recently added sub-windows

  • Dropdown Select : a basic widget for selecting one item out of a dropdown list

    Select example

  • List Select : a basic widget to select one item out of a list

  • Animator : a helper for running multiple animations with different curves/timing/dependencies

  • Animated : a helper for simple transitions.

  • PartialWidget : a widget that shows a widget if its data is present

    Multivalue example

  • MultiRadio : a Radio that represents multiple values through an inner widget

  • MultiCheckbox : a Checkbox that represents multiple values through an inner widget

  • Switcher : a widget which displays the first widget for which the associated Prism returns Some()

  • LazySwitcher : a widget like Switcher but the inner widget are created lazily on demand.

  • TooltipController : a convenient way to pop up text tooltips on mouse hover

  • OnMonitor : a helper widget for keeping subwindows from going outside the monitor bounds

  • Splits : Multiple resizable splits

  • ListFilter : a widget which filters a list for its inner widget.

  • TitleBar : a widget that is treated as a window's titlebar. (Only on windows)

  • An advanced version of the slider which also allows keyboard input.

    Advanced Slider example

  • material_icons::Icon : A helper for drawing material icons.

ProgressBar Improvements

  • Building on the existing progress bar in druid.
  • Making styling options more configurable, using theme values as defaults, with options in the widget to override.
  • Removed constraint on widget width, the widget will now expand to fit its container.
  • Future Idea: Add optional configuration for text that would go over the progress bar.
  • Future Idea: Draw the entire rounded rectangle for the progress bar and then truncate it, so gradients don't size to the current progress, but always to what would be a full progress bar. At least as an option.
  • TODO: Should width and height be completely configurable, both sized to expand into their container?
  • TODO: review theme values more generally, concerned that they might not be getting used consistently.

Widget Requests

If you need a certain widget, and you think it might be useful to others, feel free to make a PR adding it to this list.

  • A really good, general widget for laying out collections of items.
    • There are different approaches we could use (flexbox or grid from the HTML world).
    • This might be multiple widgets serving different use cases in the end.
  • A widget that works like druid::widget::Scroll but also supports zooming its content.
  • A color picker

Links to widget crates

Maybe you have made your own collection of widgets that aren't general enough to go into druid proper, but will still be useful to other druid users. Submit a PR to add them here!

  • druid-graphs: An alpha quality library for drawing graphs as widgets, taking inspiration from matplotlib. Currently only supports a few graph types, collaboration welcome! Works well with druid-lens-compose.
  • druid_table : A table/datagrid widget (also has some interpolation/visualisation stuff currently). Uses druid_bindings
  • druid-enums: A widget for viewing enums, which displays different widgets depending on the variant of its data.

More Repositories

1

druid

A data-first Rust-native UI design toolkit.
Rust
9,543
star
2

xilem

An experimental Rust native UI framework
Rust
3,444
star
3

vello

A GPU compute-centric 2D renderer.
Rust
2,315
star
4

piet

An abstraction for 2D graphics.
Rust
1,251
star
5

runebender

A font editor written in Rust.
Rust
762
star
6

kurbo

A Rust library for manipulating curves
Rust
698
star
7

masonry

Rust UI design toolkit - moved.
Rust
405
star
8

skribo

A Rust library for low-level text layout.
Rust
325
star
9

glazier

Deprecated Rust Window Creation Library
Rust
209
star
10

parley

Rich text layout library
Rust
197
star
11

piet-metal

Experimental Metal-based GPU renderer for piet 2D graphics.
Rust
140
star
12

bevy_vello

An integration to render with Vello in Bevy game engine.
Rust
117
star
13

spline

A spline for interactive 2D curve design
Rust
112
star
14

velato

An integration to parse and render Lottie with Vello.
Rust
71
star
15

norad

Rust crate for working with Unified Font Object files
Rust
43
star
16

rbf-interp

An implementation of Radial Basis Function multidimensional interpolation
Rust
35
star
17

gpu-stroke-expansion-paper

Rust
35
star
18

2d.graphics

Repo for an ideational book on 2D graphics, plus tools to make images
26
star
19

peniko

Primitive types for styling vector graphics.
Rust
22
star
20

vello_svg

An integration to render SVG files with Vello.
Rust
15
star
21

wiki

Wiki and documentation for 2D graphics projects
9
star
22

android_trace

Support for Android NDK Tracing in Rust
Rust
6
star
23

rfcs

Suggestions for major changes to the linebender ecosystem
6
star
24

linebender.github.io

Main webpage for linebender org
SCSS
5
star
25

interpoli

Rust
3
star
26

runebender.app

Ruby
2
star
27

piet-snapshots

Data for snapshot testing of piet backends
2
star