Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kanety/stimulus-form-groups


https://github.com/kanety/stimulus-form-groups

Last synced: 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# stimulus-form-groups

A stimulus controller for toggle of form groups.

## Dependencies

* @hotwired/stimulus 3.0+

## Installation

Install from npm:

$ npm install @kanety/stimulus-form-groups --save

## Usage

Register controller:

```javascript
import { Application } from '@hotwired/stimulus';
import FormGroupsController from '@kanety/stimulus-form-groups';

const application = Application.start();
application.register('form-groups', FormGroupsController);
```

Import css:

```css
@import '@kanety/stimulus-form-groups';
```

Build html as follows:

```html




group1
group2


group1 content




group2 content




```

You can also toggle multiple groups at once:

```html



group1
group2


group1 content




group2 content




```

In this example, `group1 content` will be shown whichever options you select.

You can also use multiple input elements by setting combination of name and value as group id:

```html





group1 content




group2 content




```

### Options

#### mode

You can toggle disabled status for input elements:

```html



```

## License

The library is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).