Checkbox
Multiple selection from multiple choices.
Form
ComponentForm
component is the input gathering interface. Despite as simple as it
sounds, there are a lot of complicated guides and tutorials all over the
Internet. Bissetii did a number of researches on its own and decided to only
provide styling for proper HTML5 semantic syntax defined by w3.org.
This component is available starting from v1.12.1
.
Bissetii prepared a number of Hugo interfaces to generate Form
component
seamlessly across all output formats.
To use Form
component, you need to include "form"
extension module into your
front-matter or the global amp.toml
data file. The code pattern is as follows:
|
|
Bissetii will automatically includes the extension module seamlessly in
accordance to the output format (e.g. amp-form
extension module for AMPHTML).
By default, it is hard to process images across multiple outputs while maintaining a single input format. Hence, Bissetii prepared the following shortcodes to standardize the image rendering. These shortcodes are specific to Bissetii which works differently from Hugo.
form
ShortcodeThe form
shortcode is for creating form quickly in Hugo. Its parameters
definition varies depending on the Bissetii version used.
v1.13.0
and AboveThe shortcode pattern is as follows:
|
|
METHOD
- COMPULSORY. The from method (e.g. POST
).ACTION
- COMPULSORY. The form submission action URL.CONTENT
- COMPULSORY. The form structure in HTML format.Example usage with shortcode inside shortcode:
|
|
v1.12.5
and BelowThe shortcode pattern is as follows:
|
|
METHOD
- COMPULSORY. The from method (e.g. POST
).ACTION
- COMPULSORY. The form submission action URL.CONTENT
- COMPULSORY. The form structure in HTML format.Example usage with shortcode inside shortcode:
|
|
Coming Soon.
Bissetii supports Form
component via the use of <form>
, <fieldset>
, and
<input>
native HTML tags. Additionally, starting from version v1.13.0
, the
use of CSS variable is vital for its upgrade from v1.12.5
.
Form
component is slightly different depending on the HTML output formats.
Here are the Bissetii’s supported formats.
Bissetii supports Form
component natively and seamlessly. Here is an example:
|
|
The recommended methods for a form are: POST
, PUT
, PATCH
, and DELETE
.
When in doubt, always use POST
.
For AMPHTML to use Form
component, the AMP Form library is required and shall
be imported inside the <head>
section as instructed by
AMP Specification.
|
|
Some notable differences for AMPHTML would be the POST
method. In AMPHTML,
the form uses its specialized action-xhr=
instead of action=
attribute.
Here is an example of the AMPHTML form:
|
|
Another differences would be the prohibition of some <input>
types such as
button
and image
. To learn the allowed <input>
list, please refer to the
AMP Specification.
Both HTML5 and AMPHTML facilitates pattern=
attribute for validating data in
any <input>
(including <textarea>
). This in turns will ensure the input data
from user via the form interface is at least matching the necessary requirement.
Example:
|
|
Bissetii styled every <input>
and <textarea>
to respond for all statuses
like invalid
, valid
, and focus
for both optional and required
fields.
Here is an example for password field that needs 33 characters minimum length,
minimum 1 captial character, 1 lowercase character, 1 number and 1 symbol. You
can try inserting the following values to see how the fields react to it:
Result | Value |
---|---|
invalid | Testing54645#@#$ |
valid | Testing-Monoxide-G@nd@lf-Whatever-2122 |
Bissetii will document all recommended validation patterns accordingly in the each of the input types section.
<fieldset>
For GroupingInstead of using custom <div>
HTML tag for grouping purposes like
<label>
+<input>
or a set of them in 1 group, Bissetii uses the native
<fieldset>
and <legend>
to get the job done, even for the extreme case where
CSS is unavailable.
The use case is simple: there should only be 1 <legend>
in each <fieldset>
and you can wrap as many <fieldset>
as needed. Here is an example for login
form:
|
|
This will render as:
.border
CSS ClassTo quickly set a <fieldset>
to show its original border, you just need to
append .border
CSS class tag to the <fieldset>
. Example:
|
|
.center
CSS ClassTo quickly set a <fieldset>
to set everything including its <legend>
to
center, you just need to append .center
CSS class tag to the <fieldset>
.
Example:
|
|
Grid
ComponentBissetii recommends to use Grid
Component to organize the form and layout into a desired style
(e.g. inline fields). Here is an example for generating an inline login form:
|
|
This will render as:
<ol>
or <ul>
for ListingBissetii prepared and styled all list (<ol>
and <ul>
) within the form to
behave as invisible non-bullet list. This facilitates listing multiple options
input like checkbox type and radio type. Here is an example of listing a
checkbox:
|
|
This will render as:
To set the list scales horizontally, simply add .inline
CSS class to the list
HTML tag. Example:
|
|
This will render as:
<datalist>
for Pre-defined ValuesFor some <input>
types, it is possible to supply pre-defined values to make
data filling easier.
To do that, you need to define a <datalist>
with specific id=
attribute then
supply the id
into the <input>
’s list=
attribute.
Only text
, search
, url
, tel
, email
, date
, month
, week
, time
,
datetime-local
, number
, range
, and color
are allowed to use.
For each <option>
, there are 2 key attributes to use value=
and label=
.
The label=
may work for those that allows to display like date selection.
Here is an example:
|
|
minlength=
And maxlength=
To Limit Text CharactersHTML5 supplies minlength=
and maxlength=
attributes for compatible <input>
to limit the acceptable values' length at the client side. The values shall be
a round number. Here is an example:
|
|
This will render as following (try input values less than or more than 8 digits):
min=
And max=
To Limit Acceptable RangesHTML5 supplies min=
and max=
attributes for compatible <input>
to limit
the acceptable values at the client side. Their values are the same as value=
attribute. Here is an example:
|
|
This will render as (try providing negative number or number beyond 100):
step=
To Set Format and Alter Incremental/Decremental ChangesFor some <input>
type, HTML5 supplies step=
attribute to configure
incremental or decremental stepping values and defining the input format (e.g.
Number). Here is an example:
|
|
This will render as:
.info
And .Notice
To Provide Education InfoBissetii prepared 2 CSS classes for <label>
to educate users about a specific
<input>
.
.info
CSS class onto <label>
generates a small label information board
designed for education. This is very useful for stating essential information
such as your password requirements. Example:
|
|
.notice
CSS class onto <label>
with and without .info
CSS class will
highlight the content into high attention (e.g. colored red) notices. This is
useful for reporting error for the field. Example:
|
|
It is advisable to place the .info
before the <input>
and .notice
after
it. This simplifies the rendering process and keeping things simple. Combining
the above examples would be:
|
|
This will render as:
placeholder=
To Provide ExampleHTML5 provides placeholder=
field for most <input>
fields to hint an example
to user.
Here is an example:
|
|
This will render as:
Bissetii supports a large number of input types made available via HTML5 seamlessly. Each type has its own validation pattern and Bissetii’s recomemnded HTML code structure.
To keep communications sharp and percise, All the sample codes here will only be
the <input>
syntax without any fancy grouping or layout. Each input types are
located in the Input section. Below are the supported specific inputs:
Multiple selection from multiple choices.
Collecting color sample in hexadecimal format.
Select a complete date from a single input.
Select a complete date and time in a single input.
Gather email address from a single input.
Upload a file from a single input.
Selecting month and year from a single input.
Providing a number from an input.
Providing a password from an input.
Selecting a choice from multiple options.
Provides a search pharse from a single input.
Select a choice from dropdown menu.
Provides a trigger input for form submission.
Provides a phone number from an input.
Provides short text from an input.
Provide a large amount of text from an input.
Select a time from an input.
Provide an URL from an input.
Provide a week number from an input.
Bissetii provided a list of CSS variables dedicated for Form
styling
alteration without needing to recompile Sass. These variables are best applied
directly to the <form>
, <fieldset>
, or <input>
HTML tags whenever
applicable. Example:
|
|
As CSS variables affect the children of same kind, the use of inline styling is
also encouraged to specifically customize one particular element. Example: to
only affects the parent <fieldset>
instead of the children, the following
example works:
|
|
--form-margin
Affects the margin spacing of the entire form. The acceptable value shall be
compatible with margin:
CSS field. The default is: 2.5rem auto
.
--form-max-width
Affects the maximum width of the entire form. The acceptable value shall be
compatible with max-width:
CSS field. The default is: 100%
.
--form-list-margin
Affects the margin spacing for all list (<ol>
and <ul>
) inside the form. The
acceptable value shall be compatible with margin:
CSS field. The default is
0 0 0 2rem
.
--form-list-style-type
Affects the style type for all list (<ol>
and <ul>
) inside the form. The
acceptable value shall be compatible with list-style-type:
CSS field. The
default is none
.
--form-list-padding
Affects the padding spacing for all list (<ol>
and <ul>
) inside the form.
The acceptable value shall be compatible with padding:
CSS field. The default
is 0
.
--form-li-display
Affects the display mode of the list item (<li>
) inside the form. The
acceptable value shall be compatible with display:
CSS field. The default is
list-item
.
--form-li-margin
Affects the margin spacing of the list item (<li>
) inside the form. The
acceptable value shall be compatible with margin:
CSS field. The default is
1rem
.
--fieldset-display
Affects the display mode of a <fieldset>
and its children of same kind inside
the form. The acceptable value shall be compatible with display:
CSS field.
The default is block
.
--fieldset-margin
Affects the margin spacing of a <fieldset>
and its children of same kind
inside the form. The acceptable value shall be compatible with margin:
CSS
field. The default are:
1.5rem 0
.center
CSS class object: 1.5rem auto
--fieldset-padding
Affects the padding spacing of a <fieldset>
and its children of same kind
inside the form. The acceptable value shall be compatible with padding:
CSS
field. The default is 1rem
.
--fieldset-border-radius
Affects the edge roundness of a <fieldset>
and its children of same kind
inside the form. The acceptable value shall be compatible with border-radius:
CSS field. The default is .4rem
.
--fieldset-border
Affects the border styling of a <fieldset>
and its children of same kind
inside the form. The acceptable value shall be compatible with border:
CSS
field. The default is none
.
--fieldset-border-show
Affects the border styling of a <fieldset>
when .border
CSS tag is applied.
The acceptable value shall be compatible with border:
CSS field. The default
is .1rem solid var(--color-primary-500)
.
--fieldset-text-align
Affects the text alignment of a <fieldset>
and its children of same kind
inside the form. The acceptable value shall be compatible with text-align:
CSS
field. The default are:
left
.center
CSS class object: center
--legend-font-weight
Affects the font weight styling of a <legend>
. The acceptable value shall be
compatible with font-weight:
CSS field. The default is: bold
.
--legend-color
Affects the color of a <legend>
. The acceptable value shall be compatible
with color:
CSS field. The default is: var(--color-primary-500)
.
--input-font
Affects the font of an <input>
. The acceptable value shall be compatible
with font:
CSS field. The default is inherit
.
--input-font-size
Affects the font size of an <input>
. The acceptable value shall be compatible
with font-size:
CSS field. The default are:
inherit
1.3rem
1rem
--input-color
Affects the text color of an <input>
. The acceptable value shall be compatible
with color:
CSS field. The default is var(--color-grey-900)
.
--input-background
Affects the background styling of an <input>
. The acceptable value shall be
compatible with background:
CSS field. The default is transparent
.
--input-background-image
Affects the background image styling of an <input>
. The acceptable value shall
be compatible with background-image:
CSS field. The default is transparent
.
--input-border-radius
Affects the edge roundness of an <input>
. The acceptable value shall be
compatible with border-radius:
CSS field. The default is .4rem
--input-border-color
Affects the border color of an <input>
. The acceptable value shall be
compatible with border:
CSS field. The default is var(--color-grey-400)
.
--input-border
Affects the border styling of an <input>
. The acceptable value shall be
compatible with border:
CSS field. The default is
.1rem solid var(--color-grey-700)
.
--input-border-left-width
Affects the border thickness on the left side of an <input>
. The acceptable
value shall be compatible with border-left-width:
CSS field. The default is
.4rem
.
--input-outline
Affects the outline styling of an <input>
. The acceptable value shall be
compatible with outline:
CSS field. The default is 0
.
--input-box-shadow
Affects the box shadow styling of an <input>
. The acceptable value shall be
compatible with box-shadow:
CSS field. The default is none
.
--input-box-sizing
Affects the box shadow sizing of an <input>
. The acceptable value shall be
compatible with box-sizing:
CSS field. The default is border-box
.
--input-width
Affects the width of an <input>
. The acceptable value shall be compatible
with width:
CSS field. The default is 100%
.
--input-height
Affects the height of an <input>
. The acceptable value shall be compatible
with height:
CSS field. The default is 3.8rem
.
--input-min-height
Affects the minimum height of an <input>
. The acceptable value shall be
compatible with min-height:
CSS field. The default are:
unset
<textarea>
: 15rem
--input-padding
Affects the padding spacing of an <input>
. The acceptable value shall be
compatible with padding:
CSS field. The default is .6rem 1rem
.
--input-margin
Affects the margin spacing of an <input>
. The acceptable value shall be
compatible with margin:
CSS field. The default is 0
.
--input-appearance
Affects the appearance styling of an <input>
. The acceptable value shall be
compatible with appearance:
CSS field. The default is none
.
--input-transition
Affects the transition animation timing of an <input>
. The acceptable value
shall be compatible with transition:
CSS field. The default is
var(--animation-timing-fast)
.
--placeholder-font-style
Affects the font styling of the placeholder inside an <input>
. The acceptable
value shall be compatible with font-style:
CSS field. The default is
italic
.
--placeholder-color
Affects the text color of the placeholder inside an <input>
. The acceptable
value shall be compatible with color:
CSS field. The default is
var(--color-grey-500)
.
--label-font-size
Affects the font size of a <label>
. The acceptable value shall be compatible
with font-size:
CSS field. The default are:
inherit
.notice
and .info
CSS class tag: 1.4rem
--label-color
Affects the color of a <label>
. The acceptable value shall be compatible
with color:
CSS field. The default is inherit
.
inherit
.notice
CSS class tag: var(--color-red-500)
var(--color-red-500)
var(--color-grey-400)
--label-width
Affects the width of a <label>
. The acceptable value shall be compatible
with width:
CSS field. The default is inherit
.
--label-white-space
Affects the whitespace styling of a <label>
. The acceptable value shall be
compatible with white-space:
CSS field. The default are:
normal
.notice
and .info
CSS class tag: pre
--label-vertical-align
Affects the text vertical alignment of a <label>
. The acceptable value shall
be compatible with vertical-align:
CSS field. The default is middle
.
--optgroup-margin
Affects the margin spacing for <optgroup>
inside <select>
. The acceptable
value shall be compatible with margin:
CSS field. The default is 2rem 0 0
.
--option-padding
Affects the margin spacing for <option>
inside <select>
. The acceptable
value shall be compatible with padding:
CSS field. The default is 1.2rem 0
.
This component does not rely on any Javascript.
Depending on release version, the Sass files work differently. Bissetii does not package Sass codes explictly so please view them via the git repository.
v1.13.0
and AboveBissetii uses Dart Sass to compile the styling Sass codes into CSS file. This component’s Sass codes are available at the following location:
pkg/components/internal/form
v1.12.5
and BeforeThe Sass scripts responsible for styling the component are located in:
assets/css/bissetii/modules/core/_Form.scss
Here are the researches done to ensure Form
component meets the necessary
quality assurances:
SCHEDULED COMING SOON
That’s all about Form
component in Bissetii. If you need more feature or
need to report a bug, please feel free to file an issue at our
Issue Section.