Label and size in Vue Check box component

11 Jun 20243 minutes to read

This section explains the different sizes and labels.

Label

The CheckBox caption can be defined by using the label property. This reduces the manual addition of label for CheckBox. You can customize the label position before or after the CheckBox through the labelPositionproperty.

<template>
<ul>
<li><ejs-checkbox label='Left Side Label' labelPosition='Before'></ejs-checkbox></li>
<li><ejs-checkbox label='Right Side Label' checked=true></ejs-checkbox></li>
</ul>
</template>

<script setup>

import { CheckBoxComponent as EjsCheckbox } from '@syncfusion/ej2-vue-buttons';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);
</script>

<style>
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';

.e-checkbox-wrapper {
  margin-top: 18px;
}

li {
  list-style: none;
}
</style>
<template>
<ul>
<li><ejs-checkbox label='Left Side Label' labelPosition='Before'></ejs-checkbox></li>
<li><ejs-checkbox label='Right Side Label' checked=true></ejs-checkbox></li>
</ul>
</template>

<script>

import { CheckBoxComponent } from '@syncfusion/ej2-vue-buttons';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);
export default {
name: "App",
components: {
"ejs-checkbox":CheckBoxComponent
},
}
</script>

<style>
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';

.e-checkbox-wrapper {
  margin-top: 18px;
}

li {
  list-style: none;
}
</style>

Size

The different CheckBox sizes available are default and small. To reduce the size of default CheckBox to small, set the cssClass property to e-small.

<template>
<ul>
<li><ejs-checkbox label='Small' cssClass='e-small'></ejs-checkbox></li>
<li><ejs-checkbox label='Default'></ejs-checkbox></li>
</ul>
</template>

<script setup>

import { CheckBoxComponent as EjsCheckbox } from '@syncfusion/ej2-vue-buttons';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);

</script>

<style>
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';

.e-checkbox-wrapper {
  margin-top: 18px;
}

li {
  list-style: none;
}
</style>
<template>
<ul>
<li><ejs-checkbox label='Small' cssClass='e-small'></ejs-checkbox></li>
<li><ejs-checkbox label='Default'></ejs-checkbox></li>
</ul>
</template>

<script>

import { CheckBoxComponent } from '@syncfusion/ej2-vue-buttons';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);
export default {
name: "App",
components: {
"ejs-checkbox":CheckBoxComponent
},
}
</script>

<style>
  @import '../node_modules/@syncfusion/ej2-base/styles/material.css';
  @import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';

.e-checkbox-wrapper {
  margin-top: 18px;
}

li {
  list-style: none;
}
</style>

See Also