All Projects → dsmink → twig-bulma-form-theme-bundle

dsmink / twig-bulma-form-theme-bundle

Licence: MIT license
A Twig Form Theme for Bulma 0.3.x for use with the Symfony 2.8 / 3.x framework

Programming Languages

Twig
543 projects

Projects that are alternatives of or similar to twig-bulma-form-theme-bundle

RDForm
Create and edit RDF data in a HTML form
Stars: ✭ 16 (-33.33%)
Mutual labels:  forms
svelte-multistep-form
Svelte MultiStep Form like, this component is still in beta stage
Stars: ✭ 29 (+20.83%)
Mutual labels:  forms
drupal-template-helper
Debug Drupal 8 templates in Chrome Devtools. drupal-template-helper is a chrome extension for Drupal that lists all available templates and the preprocess hooks to use to customize your templates.
Stars: ✭ 115 (+379.17%)
Mutual labels:  twig
django-jsonfield-backport
Backport of the cross-DB JSONField model and form fields from Django 3.1.
Stars: ✭ 36 (+50%)
Mutual labels:  forms
aspect
Aspect is a compiling template engine for Lua and LuaJIT
Stars: ✭ 17 (-29.17%)
Mutual labels:  twig
aurelia-form
Fun with forms! Form utilities to make stuff just a bit (a lot) easier.
Stars: ✭ 34 (+41.67%)
Mutual labels:  forms
final-form-arrays
Array Mutators for 🏁 Final Form
Stars: ✭ 64 (+166.67%)
Mutual labels:  forms
19h47.fr
🔥
Stars: ✭ 25 (+4.17%)
Mutual labels:  twig
bulma
Bulma is a simple and a responsive Hugo theme that offers a traditional blog mixed with a landing page designed to bootstrap your frontend!.
Stars: ✭ 41 (+70.83%)
Mutual labels:  bulma-css
yaf-example
A example of yaf
Stars: ✭ 53 (+120.83%)
Mutual labels:  twig
vue-simpleform
Form library for vue. Inspired by Formik for react.
Stars: ✭ 40 (+66.67%)
Mutual labels:  forms
formularium
Formularium is a FOSS, privacy-first, and user-friendly toolkit for municipalities to support them in making their public services available online.
Stars: ✭ 88 (+266.67%)
Mutual labels:  forms
gatsby-starter-bulma-storybook
A minimal Gatsby starter which includes Bulma and Storybook
Stars: ✭ 16 (-33.33%)
Mutual labels:  bulma-css
MagicForm
The easiest way to make complex forms with validations.
Stars: ✭ 31 (+29.17%)
Mutual labels:  forms
formula-one
Strongly-typed React form state management
Stars: ✭ 66 (+175%)
Mutual labels:  forms
SuluCommunityBundle
Community features like Login, Registration, Password forget/reset for your sulu application.
Stars: ✭ 20 (-16.67%)
Mutual labels:  forms
forms-wizard
🎩 Easy to use step-by-step form for Nette Framework
Stars: ✭ 14 (-41.67%)
Mutual labels:  forms
forms
[DEPRECATED] Form controls for Nette Framework
Stars: ✭ 50 (+108.33%)
Mutual labels:  forms
Slim-Auth
A Slim 4 Skeleton.
Stars: ✭ 22 (-8.33%)
Mutual labels:  twig
rakered
The open source components from rake.red
Stars: ✭ 28 (+16.67%)
Mutual labels:  forms

twig-bulma-form-theme

A Twig 3.x Form Theme for Bulma 0.9.x for use with Symfony 5/6 framework


Twig (3.x) Bulma (v0.9.x) Form theme

Bulma is a modern CSS framework based on Flexbox. This form theme was created for use with the Twig Template engine. Twig is a modern template engine for PHP.

This form theme was built to work with Twig in combination with the Symfony Framework for websites built on top of the Bulma CSS framework.

Index

How to use the form theme:

The easiest way to make use of the form theme in Symfony is to set this form theme in the configuration file. Have a look at the Symfony documentation. Also example files are provided in this repository.

Icon support:

The theme also supports the use of icons. Bulma comes with support for the Font Awesome icon toolkit. It's realy easy to make a form widget support these themes with Symfony Form Type Extensions. An example Form Type Extension is provided within the examples directory in this repository.

Examples

widget sizes:

Widget size can be set by just using a classname. The following example is for use with the Symfony Form Type.

$builder->add('firstname', TextType::class, [
    'attr' => [
        'class' => 'is-large'
    ],
    ...
]);

Selectbox size example

NOTE

The default size needs no extra class. Suppoted sizes are is-small, is-medium and is-large.

Icons:

The following example is for use with the Symfony Form Type. This example is based on the Form Type Extension provided in the documentation examples directory.

$builder
    // Username widget with user icon
    ->add('username', TextType::class, [
	    'bulma_icon' => [
            'icon' => 'user',
            'position' => 'left',
        ],
        ...
    ])
    // Password widget with lock icon
    ->add('password', PasswordType::class, [
        'bulma_icon' => [
            'icon' => 'lock',
            'position' => 'left',
        ],
        ...
    ])
;

Username and password widgets with icons

Need more icons?

Have a look at the bulma.io and fontawesome.io website to find out which icons are available and how to implement them.

Dropdown with ChoiceType:

The following example is for use with the Symfony Form Type 'ChoiceType'

->add('checkbox_dropdown', Type\ChoiceType::class, [
    'choices' => [
        // choice groups are supported (including 'group_by' method)
        'Group header 1' => [
            'Checkbox 1' => 1,
            'Checkbox 2' => 2,
        ],
        'Group header 2' => [
            'Checkbox 3' => 3,
            'Checkbox 4' => 4,
        ],
    ],
    'label' => false, // = don't render top label (trigger button label is always rendered)
    'expanded' => true, // required to use dropdown
    'multiple' => true, // true = checkboxes, false = radio buttons
    'attr' => [
        'dropdown' => true, // required to use dropdown
        'dropdown_arrow_icon' => false, // default to true
        'class' => 'is-rounded is-outlined', // added to dropdown trigger button
    ],
])

Render it inside a form:

<!-- easiest way to render -->
{{ form_row(form.checkbox_dropdown) }}

<!-- if you need to customize a little bit -->
<div class="field">
    <!-- remove form_label() if you don't want the top label -->
    <!-- but still a customizable label inside dropdown trigger button -->
    {{ form_label(form.checkbox_dropdown) }}
    <div class="dropdown">
        {{ form_widget(form.checkbox_dropdown) }}
    </div>
</div>

Dropdown with ChoiceType

Sources

Have a look at the following websites and their documentation for more information about this subject.

  • The Bulma CSS framework website;
  • The Font Awesome font and CSS toolkit;
  • The Twig Template engine for PHP website;
  • The Symfony PHP framework website.
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].