The project is in a healthy, maintained state
Rails gem for providing SDR-specific ViewComponents.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

 Project Readme

CircleCI codecov Gem Version

SdrViewComponents

A rails gem to provide reusable view components used throughout the SDR applications and implement component library assets.

NOTE: Under Development

Until initial development is complete and this gem is published, it can only be used locally. Install by cloning the repository to your local system and then including it in your gemfile as:

gem 'sdr_view_components', path: '../sdr_view_components'

Or via github path

Requirements

This set of components relies on the component library stylesheets, add:

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2025-09-11/styles/sul.css">

with the most recent date tagged release to your application.html.erb layout file.

Usage

Add the SUL Header to your application

Supported header variations are :dark, :light, and :white (default is :light)

<%= render SdrViewComponents::Structure::HeaderComponent.new(title: 'Test Header', subtitle: 'Test Subtitle', variant: :dark) do |header| %>
  <% header.with_primary_navigation_link do %>
    <%= render SdrViewComponents::Elements::Navigation::NavItemComponent.new(text: 'Home', path: '#') %>
  <% end %>
  <% header.with_primary_navigation_link do %>
    <%= render SdrViewComponents::Elements::Navigation::DropdownMenuComponent.new(text: 'Logged in: amcollie-preview-dropdown') do |dropdown| %>
      <% dropdown.with_link do %>
        <%= link_to 'Logout', '/Shibboleth.sso/Logout', class: 'dropdown-item' %>
      <% end %>
    <% end %>
    <%# ... all primary nav links %>
  <% end %>
  <% header.with_secondary_navigation_link do %>
    <%= render SdrViewComponents::Elements::Navigation::NavItemComponent.new(text: 'Option', path: '/item1') %>
    <%# ... all secondary nav links>
  <% end %>
<% end %>

The :dark variation supports providing an rgb value via the rgb_color_str param in order to override the default dark background, for example:

<%= render SdrViewComponents::Structure::HeaderComponent.new(title: 'Test Header', subtitle: 'Test Subtitle', variant: :dark, rgb_color_str: '1, 104, 149') do |header| %>

...

<% end %>

General usage:

<% render SdrViewComponent::....>

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.