NUI - Advanced UI Library with highly customizable components and built-in CSS styling

NUI is a UI library designed to give you more control over your app’s interface, right from the Anvil designer.

It offers the following benefits out of the box -

  • Customise Everything - NUI aims to allow users to customise everything about their UI as per their brand with as minimal effort as possible. All within the designer itself.

  • Anvil Designer Friendly - It is designed to keep the workflow within the Anvil designer as much as possible

  • Wider Range of Properties & Events - NUI components offer a wider range of properties and events, allowing you to have more control over your design. Still need more? That’s also possible.

  • Use CSS anywhere - Apply CSS directly from the designer (no roles required). Get more control by defining CSS for specific states (hover, focus, etc.), and create and toggle between reusable presets. Best part? You can define CSS rules within the designer in a simpler syntax.

  • Better Structured HTML - NUI makes it easy to build properly structured pages with appropriate tags, making your apps more accessible and SEO-friendly

  • Support for more Icons - NUI allows support for three popular libraries - Font Awesome, Material Icons, and Bootstrap Icons

  • Easier integration with JS - Allows a more simplified approach for adding custom JS events or DOM manipulation

You can get started by Cloning the dependency - Anvil | Login

Or try the example app - https://anvil.works/build#clone:3GYIU4PY32WJJYH7=VJVCIHWDDM2W2BG75J7O6NSP

Link to docs - Introduction | NUI for Anvil

This is still in Beta. If you have any questions or want to report an issue, you can do so on the GitHub repository - Divyesh06/nui-for-anvil · Discussions · GitHub

14 Likes

This looks like a crazy amount of effort. What was the inspiration?

2 Likes

Awesome! I love it! Now I can get rid of jQuery for 90% of my use cases (darn 10% needed for raw HTML and dynamic on the spot calculations, haha)

1 Like

And it even accepts media queries :face_with_open_eyes_and_hand_over_mouth:

1 Like

I had the basic idea years ago - Make Anvil more Role Free

At that time, custom components weren’t that developed and there was no way to get live changes on them. But after the recent developments to custom components, there was nothing stopping this.

And it didn’t take that long. Probably 10-15 hours? And the time & efforts it saves me later should be worth it.

6 Likes

Great work and thanks for sharing!! :slight_smile:

Hopefully the anvil team picks up this approach for the built in components and the anvil designer in general - i have been waiting for this for very long.

Again, awesome work @divyeshlakhotia :pray:

3 Likes

Amazing job! The presets at the top bar is genius!
And I love that the css animates by default.
Also, I’ve always wanted a way to “morph” elements from one type to another (i.e. textinput to textarea)

I’ll check out the git to properly request some features.

Thank you for creating this!

2 Likes

This is absolutely amazing - this is exactly the sort of thing we were hoping to enable you to build with the new approach to themes!

We’d love to hear your feedback about the process of building this toolkit. It has definitely caused us to accelerate documenting some (currently internal but scheduled for public release) hooks you could use to make it even slicker :smiley:

2 Likes

Thanks! There were definitely a lot of improvements to custom components that I only found out about when building this. And I did discover some hidden features (like inline editing and designer name) by taking a look at the source code from the m3 dependency.

1 Like

Those are definitely examples of things we want to document fully, so you don’t have to grub through the docs.

Also on that list: Have you seen how the M3 components implement their spacing properties? They’re a superset of the CSS margin and padding, but produce a nice draggable widget in the designer, and there are a couple of handy functions in anvil.property_utils to make them super easy to implement

2 Likes

Definitely something I missed. And definitely something I would love to implement next. Currently, it just uses separate margin and padding properties, which are not as easy to use as the widget (And bad for someone like me who always forgets the order for the different sides)

1 Like

You can do those too! They just don’t produce the nice combined margin/padding widget. (At least one built in Anvil component - FlowPanel I think - does this because we already had spacing meaning something else)

2 Likes

This is great. Learning a lot just looking through this. preset implementation is cool.

2 Likes

The v2 of NUI is now available. NUI is now available as a third party dependency using the following token - 3ACFHAQDBLLJX7FL

The new version also brings the following improvements, additions and changes

  • New Image and Link components

  • An experimental HTML to NUI converter which converts any html code into a proper anvil form with NUI components that you can customise or add interactivity to. Learn more at HTML to NUI Converter | NUI for Anvil

  • [Experimental] true_html_structure property in NUI containers that removes any anvil wrappers for components added to it. Used in the HTML to NUI converter. Note: This patches the default add_component method on Anvil and may break things. Use with caution.

  • Preview Settings - A designer-only component that adds extra functionalities while using the Designer. Currently has two features

    • True View - Disables some designer only settings for NUI components like placeholder text, min height and enables true_html_structure in design preview (makes component unselectable)

    • Inflate Containers - Adds padding around all containers to make it easy to select them.

  • Presets Container - Another designer only component where you can place all your form presets for easier access. (Previously, this was automatically created which sometimes caused issues with the anvil designer).

  • The margin and padding properties now use the proper widget.

  • New attributes properties for all NUI components that lets you set HTML attributes.

Learn more at What's new in v2 | NUI for Anvil

7 Likes

Do you have a video showing how this library works?
Looks great

2 Likes

Not yet. But I do have an example app

And for the converter

Awesome! Thanks for sharing

1 Like