Comments (7)
From a user perspective I'd find it easiest if we can use it like
<Button icon="Facebook" variant="primary.small">
Buttontext
</Button>
and the icon automatically appears in the size mentioned in the button variant. Depending on the button variant, the icon is rendered in the respective color like Toshi mentioned :)
from marigold.
Hey @sebald @viktoria-schwarz do you have ideas how to implement the icon button?
In my opinion there are two parts but I can't stuck them together.
- On one side we have the theme where we can add the icon params (x/y padding etc.) like 'primary.large.icon'.
- On the other hand we have the icon. How to add the to the button component?
We could do something like this:
<Button variant="primary.small.icon">
<Ticket /> Primary
</Button>
But then the user have to look about the variant with icon param and have to add the icon themselve. Is there an easier way? And I dont know if this would work
from marigold.
At the moment this is the reason if we type this:
<Button variant="primary.small">
<Ticket /> Primary
</Button>
from marigold.
First I try to write a test :) But this is a good approach.
from marigold.
Another idea (and maybe easier to implement) would be like this:
<Button variant="primary.small">
<Facebook />
<Text> blabla </Text>
</Button>
and adjust the Button and its children for spacings and alignment like
<Box as="button" themeSection="button" variant={variant} {...props}>
<span style={{ display: 'inline-flex', alignItems: 'center' }}>
{children}
</span>
</Box>
with respective additions in the theme (add 'inline-flex' to button.root
and a marginRight to the Svg).
Added a first idea of it in #284
from marigold.
This is a good method! But this two aspects are important, too. (Maybe later)
- Maybe we have to find a solution for the small button default size. Default size is 24px. Small button should have 20px.
- If a button has an icon, padding-left should be:
button.small
: 12px instead of 16 andbutton.large
: 24px instead of 32. But how to say to the button that he has an icon?
from marigold.
There is no silver bullet for this. There are many different implementations for this. My suggestion:
In order to preserve composability and allow for extension: donβt use an icon prop on the button. The button should not have to know anything about its children.
You can fix the alignment with flexbox.
from marigold.
Related Issues (20)
- Update Input Field Design HOT 1
- Add Batterie + Wifi Icons
- Update to Storybook 7
- edit icon HOT 1
- Move storybook to root level HOT 1
- Introcuce `<Autocomplete>` component HOT 2
- Add leading icon and trailing button support to `<Input/>`
- Clicking on a leading icon should focus the `<Input>`
- Fix the <NumberField> Button Border on the Right HOT 1
- Refactor CSS of label positioning HOT 1
- Fix field states in `b2b-theme` HOT 2
- Test-Issue | Found a bug in my plant HOT 2
- Create new component: date field HOT 2
- [react-aria] Issues HOT 4
- Add TailwindCSS in Marigold HOT 7
- Add `prettier-plugin-sort-imports` HOT 3
- Creating Accordion for the B2B Theme HOT 1
- Tailwind: Components refactoring HOT 5
- Tailwind: Color Token Types HOT 1
- Documentation: Required Migration for Tailwind HOT 3
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 marigold.