-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Chip and ChipGroup #327
Conversation
Just trying to make the issue a little more clear: From the Mantine docs, here is an example of a single controlled Chip: import { useState } from 'react';
import { Chip } from '@mantine/core';
function Demo() {
const [checked, setChecked] = useState(false);
return (
<Chip checked={checked} onChange={() => setChecked((v) => !v)}>
My chip
</Chip>
);
} In this example, the However, in the Controlled Chip Group, the function Multiple() {
// Array of strings representing selected values when multiple is true
const [value, setValue] = useState(['react']);
return (
<Chip.Group multiple value={value} onChange={setValue}>
<Chip value="react">React</Chip>
<Chip value="ng">Angular</Chip>
<Chip value="svelte">Svelte</Chip>
<Chip value="vue">Vue</Chip>
</Chip.Group>
);
} I'm uncertain how to handle this in Dash without creating two separate What I have so far works - I just think there must be a better way.... |
Yes, there is a better way... Thanks for this suggestion @BSd3v There is now just the
|
Generated link: snehilvj/dash-mantine-components-327 |
Generated link: snehilvj/dash-mantine-components-327 |
Generated link: snehilvj/dash-mantine-components-327 |
Generated link: snehilvj/dash-mantine-components-327 |
Generated link: snehilvj/dash-mantine-components-327 |
Added 3 new components
dmc.ChipSingle
Use for a single stand-alone chipdmc.ChipGroup
Use for multiple chips in a group. Can allow the user to set either one or multiple chips in the group using themultiple
prop.dmc.Chip
Use in the children of thedmc.ChipGroup
component. Do not usedmc.ChipSingle
withdmc.ChipGroup
Note to reviewers:
There are three sample apps to demonstrate the features of these new components.
I created both the
dmc.ChipSingle
anddmc.Chip
because when thechecked
prop is updated in theChip
thendmc.ChipGroup
didn't work correctly. Thedmc.ChipGroup
uses thevalue
prop to manage the state.Is there a better way to do this rather than having both
dmc.Chip
anddmc.ChipSingle
components?Update --> Yes there was a better way -- see below. Solved by @BSd3v 🏆
Update --> Docs are ready to go 🎉 They will stay as a Draft PR until 0.14.6 is released snehilvj/dmc-docs#88