Skip to main content

com.sabre.redapp.example3.web.ui.components Sample

This sample contains usage examples of React UI Components that can be used when creating web RedApp. All examples of using individual components are displayed in one modal.

UI Components sample modal

Each example of using the component is in a separate package named as the component.

UI Components webmodule structure

MultiWidgetModal is main react class which initialize individual components.


Select Widget

This is example usage of Select Widget.

  • Entire logic is in SelectWidgetPart class which is responsible for displaying a simple form with two component instances.

    • First one with given AIRPORT domain, optionsLimit property set to 3, nextComponentToFocusRef set to the second instance of SelectWidget and defaultValue set to 'KRK'.

<FormGroup key={'select-airport-domain'}>
        Select Widget - AIRPORT Domain
    <SelectWidget id={'select-airport-domain'}
                  onValueChange={(value) => this.handleValueChange(value, 'select-airport-domain')}
  • Second one with given customDomain:

private selectWidgetRef: React.ReactInstance;

const items = [
    {"label": "Economic", "value": "ECO"},
    {"label": "Business", "value": "BUS"},
    {"label": "Premium", "value": "PRE"}

<FormGroup key={'select-custom-domain'}>
        Select Widget - Custom Domain
    <SelectWidget id={'select-custom-domain'}
                  onValueChange={(value) => this.handleValueChange(value, 'select-custom-domain')}
                  ref={ref => this.selectWidgetRef = ref}
The reference to this instance is passed to the local selectWidgetRef variable in order to set it in the previous SelectWidget instance.

In both cases onValueChange parameter was set to local handleValueChange method which sets received values in local state, which is displayed below the select widget input.

The picture of the "Select Widget" modal part:

Select widget modal part

Date Picker

This is example usage of Date Picker.

  • Entire logic is in DatePickerPart class which is responsible for displaying a simple form with date picker.

const dFormat = 'DD-MM-YYYY'

handleDateChange = (event: moment.Moment | string) => {
    if (moment.isMoment(event)) {
            selectedDate: event.format(dFormat)
    } else {
            selectedDate: event

        SRW Date Picker
    <div>Selected {this.state.selectedDate}</div>

Above example shows simple usage of SrwDatePicker component with the selected type of date formatting set, displaying two months in the popover. Data returned by the component is handled by the handleDateChange method which set received value as local state which is then displayed below the form.

The picture of the "Date Picker" modal part:

Date Picker modal part