View
The universal container element to wrap UI views. In browsers, it uses HTML <div>
element. In native mobile apps, like React Native, it uses <View>
.
Use View component to abstract away framework implementations, so that your app works on all platforms.
Most Webframe UI components have View
as the wrapper element. This means that in addition to each component's props, you can send in View props, or make it scrollable.
Props
Prop | Type | Default | Description |
---|---|---|---|
className | Class Name | CSS class names separated by space | |
col | Boolean | Whether to use vertical (i.e. column) layout. By default, it is | |
row | Boolean | Whether to use horizontal layout. By default, it is falsy | |
grid | Boolean | Whether to use grid layout, instead of the default | |
fill | Boolean | Whether to make the view fill up available height and width | |
reverse | Boolean | Whether to reverse the render order of inner content items | |
rtl | Boolean | Whether to use right to left text, layout, and scroll direction | |
left | Boolean | Align inner content to the start | |
right | Boolean | Align inner content to the end | |
top | Boolean | Align inner content to the top | |
bottom | Boolean | Align inner content to the bottom | |
center | Boolean | Align inner content to the center horizontally | |
middle | Boolean | Align inner content to the middle vertically | |
sound | Object | @param {object|HTMLAudioElement} new Audio(URL) sound file to play on click | |
children | String |Number |Boolean |Function | Inner content to render | |
childBefore | String |Number |Boolean |Function | Custom UI to render before | |
childAfter | String |Number |Boolean |Function | Custom UI to render after | |
preventOffset | Boolean | Whether to prevent components from setting size offset for this component.
This can prevent bugs caused by children Scroll components with | |
tooltip | String |Number |Boolean |Function |Object | Tooltip props (or content) to display as popup on interaction with this component | |
scroll | Boolean | Whether to enable | |
scrollAlongDirectionOnly | Boolean | Whether to restrict scrolling along the layout direction. Scrollable in all directions by default. | |
scrollClass | Class Name | CSS class for inner wrapper Scroll component | |
scrollProps | Object | Props for the inner Scroll component | |
scrollOffset | Boolean |Enum | Whether to allow | |
scrollOverflowProps | Object |Boolean | Props for outer Scroll | |
scrollReversed | Boolean | When
Here is how it works when enabled:
To achieve left scrollbar without changing horizontal scroll direction,
restrict this | |
scrollRef | Function |Object | Ref for the inner Scroll component | |
_ref | Function |Object | Ref for the View or outer Scroll container |
Examples
Distribution & Alignment
Horizontal Layout & Scrolling
- horizontal layout examples with
Row
component - content overflow examples with
scroll
mode enabled.