Skip to main content

VPanel

The VPanel is a dynamic container widget designed to hold two child widgets aligned vertically. Featuring an adjustable splitter between the widgets, HPanel allows users to resize the width of the child widgets effortlessly.

src/main.tsx

import { WLabel } from "@cedro/ui/label.ui";
import { WVPanel } from "@cedro/ui/vpanel.ui";
import { WContainer } from "@cedro/ui/container.ui";
import { createWidget } from "@cedro/ui/widget.builder";

export default createWidget(
<WVPanel padding={5}>
<WContainer variant="contained" fixedSize={250}>
<WLabel text="Left Widget" centerX centerY />
</WContainer>
<WContainer variant="contained">
<WLabel text="Right Widget" centerX centerY />
</WContainer>
</WVPanel>
);

Key Features

  • Vertical Alignment: Holds two child widgets in a vertical layout.

  • Resizable Splitter: Includes a handle between the widgets for easy vertical resizing, allowing dynamic adjustment of widget widths.

Implement the HPanel in your project for a responsive and user-friendly layout that enhances the flexibility and functionality of your application's design.

Properties

The VPanel widget inherits from Widget class → Has all Widget properties.
  • topContent: Widget → The top child widget.
  • bottomContent: Widget → The bottom child widget.
  • topHeight: number → The top widget size.
  • bottomHeight: number → The bottom widget size.

Constructor

ParameterTypeRequiredDescription
idstringyesThe id of the widget
parentWidgetnoThe parent of the widget. Default is null
src/main.ts
import { VPanel } from "@cedro/ui";

const myPanel: VPanel = new VPanel("my-panel");

myPanel.setTop(contentWidget1, 200);
myPanel.setBotttom(contenWidget2);

Public Methods

setTop

Set the top child widget.

Parameters

ParameterTypeRequiredDescription
widgetWidgetyesThe top child widget.
fixHeightnumbernoThe top child widget size. Default is null

Returns Value

void

Example

src/main.ts
myPanel.setTop(contentWidget1, 200);

setBottom

Set the bottom child widget.

Parameters

ParameterTypeRequiredDescription
widgetWidgetyesThe bottom child widget.
fixHeightnumbernoThe bottom child widget size. Default is null

Returns Value

void

Example

src/main.ts
myPanel.setBottom(contentWidget2);