The View component can be used to encapsulate other components and provide structure. It functions similar to a div in the web world. It is based on NodeGui's QWidget.


import React from "react";
import { Renderer, Button, Window, View } from "./index";
const App = () => {
return (
<Button style={buttonStyle} text={"Hello"} />
<Button style={buttonStyle} text={"World"} />
const buttonStyle = `
color: white;
Renderer.render(<App />);

Type parameters

Signals: object





Optional attributes

attributes? : WidgetAttributesMap

Prop to set the Widget Attributes. example: <View attributes={{[WidgetAttributes.WA_Disabled]: true}} />

Optional cursor

cursor? : CursorShape | QCursor

Sets the window mouse cursor. QWidget: setCursor

Optional enabled

enabled? : undefined | false | true

Sets the property that tells whether the widget is enabled. In general an enabled widget handles keyboard and mouse events; a disabled widget does not. QWidget: setEnabled

Optional geometry

geometry? : Geometry

Sets the screen position as well as size of the widget. QWidget: setGeometry

Optional id

id? : undefined | string

Sets the object name (id) of the widget in Qt. Object name can be analogous to id of an element in the web world. Using the objectName of the widget one can reference it in the Qt's stylesheet much like what we do with id in the web world. QWidget: setObjectName

Optional maxSize

maxSize? : Size

Sets the maximum size of the widget. QWidget: setMaximumSize

Optional minSize

minSize? : Size

Sets the minimum size of the widget. QWidget: setMinimumSize

Optional mouseTracking

mouseTracking? : undefined | false | true

Sets the property that tells whether mouseTracking is enabled for the widget. QWidget: setMouseTracking

Optional on

on? : Partial‹WidgetEventListeners | Signals›

Prop to set the event listener map. See Handlong Events

Optional pos

pos? : Position

Sets the screen position of the widget. QWidget: move

Optional ref

ref? : any

Prop to set the ref. The ref will return the underlying nodegui widget.

Optional size

size? : ViewSize

Sets both the minimum and maximum sizes of the widget. QWidget: setFixedSize

Optional style

style? : undefined | string

Sets the inline stylesheet property. QWidget: setInlineStyle

Optional styleSheet

styleSheet? : undefined | string

Sets the property that holds the widget's style sheet. QWidget: setStyleSheet

Optional visible

visible? : undefined | false | true

Shows or hides the widget and its children. QWidget: show

Optional windowFlags

windowFlags? : WindowFlagsMap

Prop to set the Widget flags. example: <View windowFlags={{[WindowType.SplashScreen]: true}} />

Optional windowIcon

windowIcon? : QIcon

Sets the window icon. QWidget: setWindowIcon

Optional windowOpacity

windowOpacity? : undefined | number

This property holds the level of opacity for the window. QWidget: setWindowOpacity

Optional windowState

windowState? : WindowState

Sets the window state. QWidget: setWindowState

Optional windowTitle

windowTitle? : undefined | string

Sets the window title property. QWidget: setWindowTitle