All Projects → DFE-Digital → govuk-components

DFE-Digital / govuk-components

Licence: MIT license
Lightweight components for developing with the GOV.UK Design System

Programming Languages

ruby
36898 projects - #4 most used programming language
Slim
82 projects
HTML
75241 projects
SCSS
7915 projects

Projects that are alternatives of or similar to govuk-components

sketch wireframing kit
Quick Sketchapp wireframing tool for UK government digital services
Stars: ✭ 74 (-11.9%)
Mutual labels:  govuk, govuk-frontend
Styleguides
GOV.UK coding standards and guidelines for other tools we use
Stars: ✭ 179 (+113.1%)
Mutual labels:  govuk
Whitehall
Publishes government content on GOV.UK
Stars: ✭ 634 (+654.76%)
Mutual labels:  govuk
Govuk Guix
Package, service and system definitions using GNU Guix for software and systems related to GOV.UK.
Stars: ✭ 58 (-30.95%)
Mutual labels:  govuk
Blinken
RETIRED. Superseded by https://github.com/alphagov/blinkenjs
Stars: ✭ 13 (-84.52%)
Mutual labels:  govuk
Static
GOV.UK static files and resources
Stars: ✭ 100 (+19.05%)
Mutual labels:  govuk
govuk-docker
GOV.UK development environment using Docker 🐳
Stars: ✭ 37 (-55.95%)
Mutual labels:  govuk
Govuk React
An implementation of the GOV.UK Design System in React using CSSinJS
Stars: ✭ 219 (+160.71%)
Mutual labels:  govuk
Magna Charta
Accessible, useful, beautiful barcharts from HTML tables.
Stars: ✭ 151 (+79.76%)
Mutual labels:  govuk
Fabric Scripts
GOV.UK Fabric scripts
Stars: ✭ 56 (-33.33%)
Mutual labels:  govuk
Design Principles
Serves /design-principles on GOV.UK
Stars: ✭ 55 (-34.52%)
Mutual labels:  govuk
Gds Sso
OmniAuth adapter to allow apps to sign in via GOV.UK signon
Stars: ✭ 21 (-75%)
Mutual labels:  govuk
Govuk Puppet
Puppet manifests used to provision the main GOV.UK web stack
Stars: ✭ 109 (+29.76%)
Mutual labels:  govuk
Govuk Component Guide
A style guide for GOV.UK Components shared between applications
Stars: ✭ 16 (-80.95%)
Mutual labels:  govuk
Router
Router in front on GOV.UK to proxy to backend servers on the single domain
Stars: ✭ 181 (+115.48%)
Mutual labels:  govuk
Govuk Aws
The GOV.UK repository for our Migration to AWS
Stars: ✭ 334 (+297.62%)
Mutual labels:  govuk
Cdn Acceptance Tests
CDN Acceptance Tests
Stars: ✭ 46 (-45.24%)
Mutual labels:  govuk
Govspeak
Markdown extension library for Government editors
Stars: ✭ 65 (-22.62%)
Mutual labels:  govuk
Frontend
Serves the homepage, transactions and some index pages on GOV.UK
Stars: ✭ 234 (+178.57%)
Mutual labels:  govuk
Government Service Design Manual
Government Service Design Manual
Stars: ✭ 186 (+121.43%)
Mutual labels:  govuk

GOV.UK Components

Tests Maintainability Gem Version Gem Test Coverage GitHub license GOV.UK Design System Version Rails Ruby

This gem provides a suite of reusable components for the GOV.UK Design System. It is intended to provide a lightweight alternative to the GOV.UK Publishing Components library and is built with GitHub’s ViewComponent framework.

It aims to implement the functionality from the original Nunjucks macros in a way that will feel more familiar to Rails developers. Blocks are preferred over strings of HTML, beneath the surface each component is just a Ruby object, everything is inheritable and overrideable.

Documentation

The gem comes with a full guide that covers most aspects of day-to-day use, along with code and output examples. The examples in the guide (and the guide itself) are built using the components, so it will always be up to date.

Netlify Status

What’s included?

All of the non-form components from the GOV.UK Design System are implemented by this library as ViewComponents. Form components are implemented by the GOV.UK Form Builder.

The provided components are:

This library also provides helpers for creating links, buttons, skip links and back to top links.

Alternative syntax

All of the components can be rendered in two ways:

  • directly using Rails’ #render method:

      <%= render GovukComponent::WarningTextComponent.new do %>
        A serious warning
      <% end %>
  • via the helper wrapper:

      <%= govuk_warning_text do %>
        A serious warning
      <% end %>

    The naming convention for helpers is govuk_ followed by the component’s name in snake case. You can see the full list in GovukComponentsHelper.

Example use

This library allows components to be rendered with Rails’ render method or via the provided helpers. Here we’ll use the govuk_tabs to render three tabbed sections:

<%= govuk_tabs(title: 'Days of the week') do |component| %>
  <% component.tab(label: 'Monday') do %>
    <p>Monday’s child is fair of face</p>
  <% end %>

  <% component.tab(label: 'Tuesday') do %>
    <p>Tuesday’s child is full of grace</p>
  <% end %>

  <% component.tab(label: 'Wednesday') do %>
    <p>Wednesday’s child is full of woe</p>
  <% end %>
<% end %>

Here are the rendered tabs:

Tabs preview

For examples on usage see the guide page.

Setup

Add this line to your config/application.rb:

require "govuk/components"

Services using this library

Installation

Add this line to your application’s Gemfile:

gem 'govuk-components'

And then execute:

bundle

Or install it yourself as:

gem install govuk-components

Contributing

Bug reports and feature requests are most welcome, please raise an issue or submit a pull request.

Currently we're using GOVUK Lint to ensure code meets the GOV.UK guidelines. Please ensure that any PRs also adhere to this standard.

To help keep the logs clean and tidy, please configure git to use your full name:

git config --global user.name "Julius Hibbert"

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].