About

What's a component?

A simple way to share UI patterns between applications without having to duplicate code

Components hook in to your application template path and will allow you to insert a partial, which will handle it's own markup and styling.

You can can consider them an abstraction/blackbox around a piece of UI, where you don't want to care about how it works, just that it does.

How do I use one?

You need to be using Slimmer in your Rails app, and add include Slimmer::GovukComponents to your ApplicationController.

class ApplicationController < ActionController::Base include Slimmer::GovukComponents end

From a template call a partial scoped to govuk_component/ followed by the component name (available components).

<%= render partial: 'govuk_component/example_component' %>