Customize icon and width in React Drop down button component
7 Aug 20233 minutes to read
Width of the DropDownButton can be customized by setting required width to the dropdown element.
The following UI can be achieved by setting iconPosition
as Top
, width as 85px
and size of the font icon as 40px
by adding e-custom
class.
import { enableRipple } from '@syncfusion/ej2-base';
import { DropDownButtonComponent } from '@syncfusion/ej2-react-splitbuttons';
import * as React from 'react';
import * as ReactDom from 'react-dom';
enableRipple(true);
// To render DropDownButton.
function App() {
let items = [
{
text: 'Find'
},
{
text: 'Replace'
},
{
text: 'Go To'
},
{
text: 'Go To Special'
}
];
return (<div>
<DropDownButtonComponent items={items} iconCss='e-icons e-search' cssClass='e-custom e-vertical' iconPosition='Top'>Find & Select</DropDownButtonComponent>
</div>);
}
export default App;
ReactDom.render(<App />, document.getElementById('button'));
import { enableRipple } from '@syncfusion/ej2-base';
import { DropDownButtonComponent, ItemModel } from '@syncfusion/ej2-react-splitbuttons';
import * as React from 'react';
import * as ReactDom from 'react-dom';
enableRipple(true);
// To render DropDownButton.
function App() {
let items: ItemModel[] = [
{
text: 'Find'
},
{
text: 'Replace'
},
{
text: 'Go To'
},
{
text: 'Go To Special'
}];
return (
<div>
<DropDownButtonComponent items = {items} iconCss='e-icons e-search' cssClass='e-custom e-vertical' iconPosition='Top'>Find & Select</DropDownButtonComponent>
</div>
);
}
export default App;
ReactDom.render(<App />,document.getElementById('button'));