PHPackages                             purplespider/silverstripe-bootstrap-form-templates - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. purplespider/silverstripe-bootstrap-form-templates

ActiveSilverstripe-vendormodule[Templating &amp; Views](/categories/templating)

purplespider/silverstripe-bootstrap-form-templates
==================================================

Bootstrap 5 form templates for Silverstripe 4, 5 &amp; 6

1.0.4(7mo ago)11381BSD-3-ClauseScheme

Since Feb 2Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/purplespider/silverstripe-bootstrap-form-templates)[ Packagist](https://packagist.org/packages/purplespider/silverstripe-bootstrap-form-templates)[ Docs](https://github.com/purplespider/silverstripe-bootstrap-form-templates)[ RSS](/packages/purplespider-silverstripe-bootstrap-form-templates/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Bootstrap 5 Templates for Silverstripe 4, 5 &amp; 6
===================================================

[](#bootstrap-5-templates-for-silverstripe-4-5--6)

Introduction
------------

[](#introduction)

This module aims to be a (mostly) unopinionated set of form templates to mark up Silverstripe frontend forms (both custom and [Userforms](https://github.com/silverstripe/silverstripe-userforms)) to be compatible with [Bootstrap 5's form styles](https://getbootstrap.com/docs/5.0/forms/overview/).

Maintainer Contact
------------------

[](#maintainer-contact)

- James Cocker ()

Requirements
------------

[](#requirements)

- Silverstripe 4, 5 or 6
- Bootstrap 5 already installed in your theme

Installation
------------

[](#installation)

1. Install using `composer`:

```
composer require purplespider/silverstripe-bootstrap-form-templates ^1

```

2. Run `dev/build`
3. Add as the FIRST theme in your `app/_config/theme.yml`:

```
    - purplespider/silverstripe-bootstrap-form-templates:bootstrap-form-templates
```

e.g.:

```
---
Name: mytheme
---
SilverStripe\View\SSViewer:
  themes:
    - purplespider/silverstripe-bootstrap-form-templates:bootstrap-form-templates
    - '$public'
    - 'simple'
    - '$default'
```

4. To make Bootstrap's validation error styling work, add this SCSS to your theme:

```
form {
    .error.message {
        @extend .invalid-feedback;
        display: block;
    }

    .form-control,
    .form-select,
    .form-check-input {
        &.error {
            @extend .is-invalid;
        }
    }
}
```

Opinionated SCSS (optional)
---------------------------

[](#opinionated-scss-optional)

These are some opionated styles that I like to start with:

```
// Opinionated Styles
form {
    max-width: 400px !important;
    margin-top: $spacer * 2;

    // "Required" label
    .help-text {
        color: $gray-500;
        padding-left: .25em;
        font-weight: normal;
    }

    // Add spacing between different fields
    .form-group {
        margin-bottom: $spacer * 2 !important; // Overrides "mb-3"
    }

    // Style field labels
    .form-label {
        font-weight: $font-weight-bold;
        color: $gray-700;
    }

    // Style Headings, e.g. HeaderField
    .FormHeading {
        border-bottom: 2px solid $gray-200;
        padding-bottom: $spacer / 2;
        margin-top: $spacer * 4;
        margin-bottom: $spacer * 2;
    }

    // Adds a "required" legend
    &:after {
        content: "* indicates required";
        display: block;
        margin-top: $spacer * 2;
    }
}
```

Using Rows &amp; Columns for Form Layout
----------------------------------------

[](#using-rows--columns-for-form-layout)

By grouping fields into a `row` using a `FieldGroup`, you can then apply `col` classes to fields, e.g.

```
FieldGroup::create(
    TextField::create('FirstName', 'First Name')->addExtraClass('col'),
    TextField::create('Surname', 'Last Name')->addExtraClass('col'),
)->addExtraClass('row');
```

How It Works
------------

[](#how-it-works)

For full control, this module provides a complete set of form field templates, which override the default ones provided by Silverstripe and Userforms.

The templates are added as an extra theme to your site, so that they do not affect the form field in the CMS.

Handling of `RightTitle` and `Description`
------------------------------------------

[](#handling-of-righttitle-and-description)

Any `Description` text is added after the field, as per the default templates.

As the Userforms module uses `RightTitle` and not `Description`, this is also added after the field for consistency. So in your custom coded forms, you can use either (but you shouldn't use both).

Alternative Install (By Copying)
--------------------------------

[](#alternative-install-by-copying)

Rather than installing this via `composer` as a module that can't be edited, you can also just copy the files into your theme, allowing to then make any customisations (e.g. moving `Description` *before* the field.)

To do so, just copy the `PurpleSpider` and `SilverStripe` directories (within `themes\bootstrap-form-templates\templates`) into your theme's `templates` directory.

TODO
----

[](#todo)

Please note: This module is currently a work-in-progress. I've still to:

- Check certain form fields for WAI compliance, such as radio and checkbox groups.
- Add styles for Userforms multi-page forms.
- Refine handling of "required" labels.
- Refine the ability to use `FormGroup` and `addExtraClass` to layout fields in rows and columns.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance64

Regular maintenance activity

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~335 days

Total

5

Last Release

221d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/329880?v=4)[James Cocker](/maintainers/purplespider)[@purplespider](https://github.com/purplespider)

---

Top Contributors

[![purplespider](https://avatars.githubusercontent.com/u/329880?v=4)](https://github.com/purplespider "purplespider (17 commits)")

---

Tags

silverstripebootstrapForms

### Embed Badge

![Health badge](/badges/purplespider-silverstripe-bootstrap-form-templates/health.svg)

```
[![Health](https://phpackages.com/badges/purplespider-silverstripe-bootstrap-form-templates/health.svg)](https://phpackages.com/packages/purplespider-silverstripe-bootstrap-form-templates)
```

###  Alternatives

[unclecheese/bootstrap-forms

Allows you to create forms in SilverStripe that are compatible with Twitter Bootstrap.

5539.4k](/packages/unclecheese-bootstrap-forms)[contributte/forms-bootstrap

Nette extension for Bootstrap forms

211.1M4](/packages/contributte-forms-bootstrap)[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11251.0k](/packages/nepada-form-renderer)[metalogico/laravel-formello

A Laravel package for generating Bootstrap 5 and Tailwind CSS 4 forms based on models

1012.2k](/packages/metalogico-laravel-formello)[rywa/silverstripe-foundation-forms

Add ZURB Foundation framework forms compatibility to SilverStripe 3

126.4k](/packages/rywa-silverstripe-foundation-forms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
