Pulse ViewComponents
Pulse ViewComponents is an implementation of the future Pulse Design System using ViewComponent.
The implementation borrows heavily from Primer ViewComponents and Polaris ViewComponents.
This is still a work in progress and breaking changes may occur. Currently this requires Ruby 3.4 and Rails 8.1.
Usage
Render Pulse ViewComponents:
<%= render(Pulse::Badge.new(scheme: :primary)) { 'Primary' } %>Component status
Each component declares how complete it is. Check it with
Pulse::ActionList.status. Lookbook shows the status after the name of any
component that is not stable.
| Status | Meaning |
|---|---|
stable |
Complete and safe to use. |
beta |
Core usage works. Some documented options are not implemented. |
alpha |
Incomplete. Features may be broken, unstyled or missing, and the API may change without notice. |
deprecated |
Scheduled for removal. |
Components that are not stable:
| Component | Status | Gaps |
|---|---|---|
ActionList |
alpha | Select variants, trailing actions, tooltips, avatar items and the :inset scheme do not work. |
NavList |
alpha | Avatar items raise. Sub-items cannot be collapsed. The show-more item has no JavaScript. |
Counter |
alpha | Renders unstyled. |
BorderBox |
beta |
padding: and row scheme: have no effect. |
Flash |
beta |
dismissible: true raises. full: true has no effect. |
Layout |
beta | Main width: options other than :full have no effect. |
The comment above each status call in the source lists what is missing.
Dependencies
Installation
Add pulse_view_components to your Gemfile:
bundle add pulse_view_componentsAdd stylesheet and javascript links to your application layout:
<%= stylesheet_link_tag 'pulse_view_components' %>
<%= javascript_include_tag 'pulse_view_components' %>
<%= javascript_include_tag 'js/pulse_view_components', 'data-turbo-track': 'reload', defer: true %>Development
To get started:
- Run:
bundle install - Run:
yarn install - Run:
bin/dev
It will open demo app with component previews on localhost:4000. You can change components and they will be updated on page reload. Component previews are located at /previews.
To run tests:
rakeReleases
The library follows semantic versioning. To draft a new release you need to run script/release with a new version number:
bin/release VERSIONWhere the VERSION is the version number you want to release. This script will update the version in the gem and push it to GitHub and Rubygems automatically.
License
The gem is available as open source under the terms of the MIT License.