Skip to content

FieldSet

FieldSet is a <fieldset> container with an embedded Legend title. Use it to group related form fields with a visible border and title.

Usage

typescript
import { Component } from '@jimka/typescript-ui/core';
import { VBox } from '@jimka/typescript-ui/layout';
import { TextField, Label } from '@jimka/typescript-ui/component/input';
import { FieldSet } from '@jimka/typescript-ui/component/container';
const profile = FieldSet();
profile.setLegendText('Profile');

const nameField  = TextField();
const emailField = TextField();

const body = Component({
    layoutManager: VBox(),
    components: [
        Label('Name:',  nameField.getId()),
        nameField,
        Label('Email:', emailField.getId()),
        emailField,
    ],
});

profile.addComponent(body);
panel.addComponent(profile);

Common methods

MethodPurpose
setLegendText(text)Title text shown in the legend.
getLegend()Returns the underlying Legend component for direct manipulation.

See also