-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Description
https://react.semantic-ui.com/modules/dropdown#dropdown-example-header
I wanna use Dropdown.Header and Dropdown.Divider in search or multiple dropdown, but it's currently not supported. So I suppose we should extend shorthand props to support it. But it can be done in many ways so it's better to consider different options.
Header
I think the header shorthand is pretty straitforward
import React from 'react'
import { Dropdown } from 'semantic-ui-react'
const options = [
{ content: 'Important', header: { icon: 'tags', content: 'Filter by tag' } },
{ content: 'Announcement' },
{ content: 'Discussion' }
]
// <Dropdown.Header icon='tags' content='Filter by tag' />
// <Dropdown.Item>Important</Dropdown.Item>
// <Dropdown.Item>Announcement</Dropdown.Item>
// <Dropdown.Item>Discussion</Dropdown.Item>
const DropdownExampleHeader = () => (
<Dropdown text='Filter' icon='filter' floating labeled button className='icon' options={options} />
)
export default DropdownExampleHeader
Divider
I think it should be implemented by using divider shorthand with position as shorthand value. Possible positions will be 'top' | 'bottom' | 'both'.
import React from 'react'
import { Dropdown } from 'semantic-ui-react'
const options = [
{ content: 'Important' },
{ content: 'Announcement', divider: 'top' },
{ content: 'Discussion' }
]
// <Dropdown.Item>Important</Dropdown.Item>
// <Dropdown.Divider />
// <Dropdown.Item>Announcement</Dropdown.Item>
// <Dropdown.Item>Discussion</Dropdown.Item>
const DropdownExampleDivider = () => (
<Dropdown text='Filter' icon='filter' floating labeled button className='icon' options={options} />
)
export default DropdownExampleDivider
Reactions are currently unavailable