Search results

Label and Size in Angular RadioButton component

14 Apr 2021 / 1 minute to read

This section explains the different sizes and labels.

Label

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

Source
Preview
app.component.ts
app.module.ts
main.ts
Copied to clipboard
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    template: `<ul>
               <!-- Label position - Left. -->
               <li><ejs-radiobutton label="Left Side Label" name="position" labelPosition="Before"></ejs-radiobutton></li>

               <!-- Label position - Right. -->
               <li><ejs-radiobutton label="Right Side Label" name="position" checked="true"></ejs-radiobutton></li>
               </ul>`
})

export class AppComponent { }
Copied to clipboard
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RadioButtonModule } from '@syncfusion/ej2-angular-buttons';
import { AppComponent } from './app.component';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RadioButtonModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
Copied to clipboard
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

Size

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

Source
Preview
app.component.ts
app.module.ts
main.ts
Copied to clipboard
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    template: `<ul>
               <!-- Small RadioButton. -->
               <li><ejs-radiobutton label="Small" name="small" checked="true" cssClass="e-small"></ejs-radiobutton></li>

               <!-- Default RadioButton. -->
               <li><ejs-radiobutton label="Default" name="small"></ejs-radiobutton></li>
               </ul>`
})

export class AppComponent { }
Copied to clipboard
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RadioButtonModule } from '@syncfusion/ej2-angular-buttons';
import { AppComponent } from './app.component';
import { enableRipple } from '@syncfusion/ej2-base';

enableRipple(true);

/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule,
        RadioButtonModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
Copied to clipboard
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);

See Also

Contents
Contents