EN RU
Forum

Methodology

Technology

Toolbox

Libraries

Tutorials

DocumentationJSDocSource

checkbox-group

Use this block for managing a group of checkboxes.

Overview

Modifiers of the block

Modifier Acceptable values Use cases Description
type 'button', 'line' BEMJSON The type of checkbox group.
disabled true BEMJSON, JS The disabled state.
focused true BEMJSON, JS The block is in focus.
theme 'islands' BEMJSON A custom design.
size 'm', 'l' BEMJSON The size of checkbox group. Use sizes only for checkboxes with the theme modifier set to islands.

Custom fields of the block

Field Type description
name String The block unique name.
val Array A set of values for the selected checkboxes.
options Array A set of values for each checkbox of the group. Each checkbox has its own set of values.

Block description

Use the checkbox-group block to control the size, state, and appearance of the checkboxes in the group.

Modifiers of the block

type modifier

Acceptable values: 'button', 'line'.

Use case: BEMJSON.

A button-based checkbox group (type modifier with button value)

Implements the checkbox-group block using the button-based type of checkboxes.

Grouped button-based checkboxes are always aligned in a line.

Open in a new window

A line-aligned checkbox group (type modifier with line value)

The modifier aligns all checkboxes of the group in a line.

Open in a new window

disabled modifier

Acceptable value: true.

Use cases: BEMJSON, JS.

The modifier makes the block inactive. The disabled block is visible but not available for user actions.

The modifier can be applied to:

  • The checkbox-group:
Open in a new window
Open in a new window
  • The separate checkbox of the group:
Open in a new window
Open in a new window

focused modifier

Acceptable value: true.

Use cases: BEMJSON, JS.

The modifier puts the focus on the block.

{
    block : 'checkbox-group',
    mods : { theme : 'islands', size : 'm', focused : true },
    name : 'checkbox',
    val : [2],
    options : [
        { val : 1, text : 'Block' },
        { val : 2, text : 'Element' },
        { val : 3, text : 'Modifier' }
    ]
}
{
    block : 'checkbox-group',
    mods : { theme : 'islands', size : 'm', type : 'button', focused : true },
    name : 'checkbox-button',
    val : [2],
    options : [
        { val : 1, text : 'Block' },
        { val : 2, text : 'Element' },
        { val : 3, text : 'Modifier' }
    ]
}

theme modifier

Acceptable value: 'islands'.

Use case: BEMJSON.

The modifier gives the block a custom design.

The islands theme requires the size modifier.

Open in a new window
Open in a new window

size modifier

Acceptable values for the islands theme: 'm', 'l'.

Use case: BEMJSON.

Use the size modifier only for blocks with the islands theme.

Sets the size value for all types of checkbox groups.

m

Open in a new window
Open in a new window

l

Open in a new window
Open in a new window

Custom fields of the block

name field

Type: String

Specifies the block unique name.

Open in a new window

val field

Type: Array.

Specifies a set of values for the selected checkboxes.

Open in a new window

options field

Type: Array

Specifies a set of values for each checkbox of the group.

Each checkbox has its own set of values.

Field Type description
val String, Number The value to send to the server if the checkbox is selected.
text String The checkbox label, or the button label if the type modifier is set to button.
disabled Boolean The disabled state.
icon BEMJSON The checkbox icon, which is created by the icon block. Use icons only for checkboxes with the type modifier set to button.
title String Tooltip content. Use tooltips only for checkboxes with type modifier set to button.
id String The checkbox unique ID.
Open in a new window
Open in a new window
Open in a new window

Block checkbox-group

Instance methods:

getVal():String
description
Returns control value
setVal(val, [data]):checkbox-group
description
Sets control value
parameters
val
Array
value
data
Object
additional data
getName():String
description
Returns name of control
getCheckboxes():Array
description
Returns checkboxes