Sha256: a7bf1bbf09e0a85c948e84b05cf7cecbe22a386447b4cc42d2c06650e4512b6b

Contents?: true

Size: 1.92 KB

Versions: 140

Compression:

Stored size: 1.92 KB

Contents

---
title: "Introduction"
id: introduction
---

Primer contains a framework for declaratively building Rails forms. It was designed to meet the following goals:

1. Be accessible by default.
1. Integrate deeply with Ruby on Rails and its existing form capabilities.
1. Follow web standards.
1. Adhere to Primer's [form interface guidelines](/design/ui-patterns/forms).

### Accessible by default

Creating accessible forms can be challenging. Forms are a common source of accessibility issues, and can hinder someone from successfully completing and submitting a form. This can be true even for people who do not use assistive technologies.

Primer forms are designed to be accessible by default - i.e. accessible without developer effort - borrowing from Rails' sane defaults philosophy.

For example, Primer forms:

1. Automatically associate labels, captions, and validation messages with their inputs.
1. Use `<fieldset>`s where appropriate.
1. Focus the first invalid input after submission.

And more!

### Integrates with Rails

Primer forms augment Rails' battle-tested form capabilties, allowing developers to leverage their existing Rails knowledge. Primer forms delegate HTML generation to Rails, meaning inputs accept the same arguments as their vanilla Rails counterparts. For example, Primer's `#text_field` method accepts all the arguments Rails' `#text_field_tag` method accepts.

Primer forms are emitted using the familiar `#render` method, and wrapped using `#primer_form_with`, analogous to Rails' `#form_with`.

### Follows web standards

Under the hood, Primer forms are just HTML with some JavaScript sprinkles. Nothing too fancy, meaning they should work pretty much everywhere.

### What to read next

1. Read the getting started guide.
1. Take a look at the various form inputs.
1. Explore form layout options.
1. Compose forms together.
1. Include custom validation messages.
1. Submit boolean values immediately with toggle switch forms.

Version data entries

140 entries across 140 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.48.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.47.1 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.47.0 previews/pages/forms/01_introduction.md.erb
primer_view_components-0.34.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.46.1 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.46.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.45.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.44.3 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.44.2 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.44.1 previews/pages/forms/01_introduction.md.erb
primer_view_components-0.33.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.44.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.43.1 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.43.0 previews/pages/forms/01_introduction.md.erb
primer_view_components-0.32.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.42.0 previews/pages/forms/01_introduction.md.erb
primer_view_components-0.31.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.41.1 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.41.0 previews/pages/forms/01_introduction.md.erb
openproject-primer_view_components-0.40.0 previews/pages/forms/01_introduction.md.erb