React MultiView - Customize Item Appearance
To customize views in the MultiView, define an itemTemplate.
App.js
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import { MultiView } from 'devextreme-react/multi-view';
- const multiViewItems = [{
- title: 'Personal Data',
- data: { firstName: 'John', lastName: 'Smith', birthYear: 1986 }
- }, {
- title: 'Contacts',
- data: { phone: '(555)555-5555', email: 'John.Smith@example.com' }
- }];
- class App extends React.Component {
- render() {
- return (
- <MultiView
- dataSource={multiViewItems}
- itemRender={this.renderItem}
- />
- );
- }
- renderItem(content) {
- return (
- <div style={{ margin: 25 }}>
- <h1>{content.title}</h1>
- <div style={{ textAlign: 'left' }}>
- {
- Object.keys(content.data).map(key => {
- return (
- <p key={key}>
- {key}: <b>{content.data[key]}</b>
- </p>
- )}
- )
- }
- </div>
- </div>
- );
- }
- }
- export default App;
You can also customize individual views. Declare them using the dxItem component:
App.js
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import { MultiView, Item } from 'devextreme-react/multi-view';
- class App extends React.Component {
- render() {
- return (
- <MultiView>
- <Item text="Personal Data"/>
- <Item text="Contacts"/>
- </MultiView>
- );
- }
- }
- export default App;
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.