Coffeekraken s-accordion-component
Provide some clean accordion with colors support
Table of content
- Demo
- Install
- Get Started
- SASS API
- Browsers support
- Code linting
- Contribute
- Who are Coffeekraken?
- Licence
Install
npm install coffeekraken-s-accordion-component --save
Get Started
First, import and setup the Coffeekraken Sugar toolkit
Then, import the needed js file like so:
import 'coffeekraken-s-accordion-component'
Then, import the component into your scss file like so:
@import 'node_modules/coffeekraken-s-accordion-component/index';
Then, generate the classes like so:
@include s-accordion-classes(
$colors: default primary secondary
);
Finally, use it inside your html like so:
<dl class="accordion accordion--primary">
<dt class="accordion__title">
<a href="#accordion-1" is="s-activate" group="accordion-1">
Accordion title #1
<div class="pull-right">
<s-icon class="accordion__close" driver="fontawesome" icon="fas fa-minus"></s-icon>
<s-icon class="accordion__open" driver="fontawesome" icon="fas fa-plus"></s-icon>
</div>
</a>
</dt>
<dd class="accordion__content" id="accordion-1">
Accordion content #1
</dd>
<dt class="accordion__title">
<a href="#accordion-2" is="s-activate" group="accordion-1">
Accordion title #2
<div class="pull-right">
<s-icon class="accordion__close" driver="fontawesome" icon="fas fa-minus"></s-icon>
<s-icon class="accordion__open" driver="fontawesome" icon="fas fa-plus"></s-icon>
</div>
</a>
</dt>
<dd class="accordion__content" id="accordion-2">
Accordion content #2
</dd>
<dt class="accordion__title">
<a href="#accordion-3" is="s-activate" group="accordion-1">
Accordion title #3
<div class="pull-right">
<s-icon class="accordion__close" driver="fontawesome" icon="fas fa-minus"></s-icon>
<s-icon class="accordion__open" driver="fontawesome" icon="fas fa-plus"></s-icon>
</div>
</a>
</dt>
<dd class="accordion__content" id="accordion-3">
Accordion content #3
</dd>
</dl>
Note that in the sample above, we use the s-activate component to handle the accordion change.
Browsers support
IE / Edge | Firefox | Chrome | Safari |
---|---|---|---|
IE11+ | last 2 versions | last 2 versions | last 2 versions |
As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.
Code linting
This package uses some code linting rules. Here's the list:
-
Stylelint with stylelint-config-standard for
scss
files
Your commits will not been accepted if the code style is not respected!
Contribute
This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:
Who are Coffeekraken
We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.
More on who we are
License
The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...