Comments (3)
Have same issue. Would love to know if it's a bug or user error on my part.
from fluent-ui-react.
I managed to find a workaround (for my use case anyway) by supplying itemToString
. My code:
export const FrameSelector = () => {
const items = [
<div key="item1" placeholder="Item 1" style={{marginLeft: "10px"}}>Item 1</div>,
"Item 2"
];
function itemToString(value) {
const placeholder = value && value.props && value.props.placeholder;
return placeholder || "PLACEHOLDER NOT PROVIDED";
}
return <Dropdown itemToString={itemToString} items={items}/>
};
My goal is simply to indent some items to make the dropdown look tree-like. I don't know if the above is best practice but it serves my purpose.
I realise re-reading the OP issue that mine is not quite the same, since my content
is an element with style, but it may still be a solution to the original issue.
However, I notice that my solution does not correctly select the default value, if given:
return <Dropdown itemToString={itemToString} items={items} defaultValue="Item 1"/>
This correctly displays "Item 1" in the trigger button but when dropdown is opened the second item is highlighted not the first.
from fluent-ui-react.
@jugglingcats Thanks for the tip on itemToString
, that got me closer (sort of..) and I ended up with this:
https://codesandbox.io/s/fluent-ui-example-wo34b
The issue I'm running into now is that the active
property doesn't seem to be respected, and I'm able to select items even if it's set to active: false
.
from fluent-ui-react.
Related Issues (20)
- Memory leaks in FocusZone due to DOM object references not getting cleaned up
- Dropdown onSelectedChanged typings incorrect
- Bundle size: Single `themes` import imports all themes
- Bundle size: theme import imports several components HOT 2
- Toolbar with menu: trigger button always opens menu instead of toggling it
- Input's fluid property no effect when it is in a Form.Field?
- Carousel throws getItemPositionText is not a function
- How to change the Dropdown's container width? It is 22.25rem for now.
- Animation with no children throws
- Can't add custom colors to colorScheme? HOT 1
- Which technology to choose: office-ui-fabric-react vs fluent-ui-react HOT 1
- Toolbar overflow menu is misaligned/shifting rest of a page when clicked
- Tooltip: wrong outline on Button
- Popup: `offset` breaks arrow pointer
- [RFC] Implementing reveal highlight
- Popup: pointing beak is broken on edges HOT 1
- AccordionTitle content is not exposed as a slot
- README.md: Broken link in the "Why?" section
- Safari: Wrong focus indicator on Input
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent-ui-react.