RFC: Dropdown header and divider shorthands
See original GitHub issuehttps://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
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Bootstrap class: .dropdown-divider
Bootstrap CSS class dropdown-divider with source code and live preview. You can copy our examples and paste them into your project!
Read more >Dropdown - Semantic UI React
A dropdown menu can contain dividers to separate related content. ... Dropdown state is not fully managed when using the subcomponent API. The...
Read more >pentacle keyboard symbol
Choose your font from the Font drop-down menu. RIGHT-HANDED INTERLACED PENTAGRAM ⛥, SAILBOAT. They see their organization as eternal and impossible to ...
Read more >Dropdown | Fomantic-UI Docs
A dropdown allows a user to select a value from a series of options. ... A dropdown menu can contain dividers to separate...
Read more >Dropdowns - Bootstrap
Wrap the dropdown's toggle (your button or link) and the dropdown menu ... else here</a> <div class="dropdown-divider"></div> <a class="dropdown-item" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for starting this RFC. In addition to the linked #889, it is also closely related to #1365 (submenu’s and nested dropdown menu’s).
I’d propose that we standardize on the
component
key to define which component the props are for. This would apply to any shorthand. Updating the example Dropdowns you provided above:Header
Divider
What seems to do the trick after #4029 is to define headers and dividers as follows within the dropdown options: