Skip to content
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

Consider adding non-markdown elements to Styled #152

Closed
jxnblk opened this issue Jul 3, 2019 · 6 comments
Closed

Consider adding non-markdown elements to Styled #152

jxnblk opened this issue Jul 3, 2019 · 6 comments

Comments

@jxnblk
Copy link
Member

jxnblk commented Jul 3, 2019

Some HTML elements might be expected to exist in the Styled components, e.g. Styled.button, but don't currently. It's probably not harmful to add a few more common elements to the mix.

@connorholyday
Copy link

This idea makes sense to me as I'm using theme-ui for both HTML (landing page) and markdown (blog). Adding all of my base elements to the theme config keeps things nice and tidy without having to look-up which elements markdown doesn't support - or double checking my variants for those extra elements. Then markdown can pick up all of the Styled components it needs and I have one section for all of my base elements.

Is it as simple as updating the tags array here?

@jxnblk
Copy link
Member Author

jxnblk commented Jul 23, 2019

Yes, but we'll want to still limit which tags we add here since they'll increase the overall bundle size and cannot be tree-shaken

@connorholyday
Copy link

I see! Forgive me if this is a silly question, but could these extra non-markdown elements be generated by mapping over the theme.styles keys? Thinking along the lines of letting people define what they need up-front via the theme config

@jxnblk
Copy link
Member Author

jxnblk commented Jul 23, 2019

I guess they could be created based on theme.styles, but that would probably require creating components during render, which is generally not good for performance

@connorholyday
Copy link

Oh okay that's interesting, in that case is using variants different from creating components during render? (have you got any links where I can read more about this?)

As for element suggestions, how about the base form elements: form, label, and input

@jxnblk
Copy link
Member Author

jxnblk commented Jul 23, 2019

There are some docs here, but they certainly could use some work: https://theme-ui.com/guides/variants

Variants use the theming context available in the sx prop to add the styles, so it's a bit different from creating a React component. As far as which elements, you could start a PR for discussion, if you're interested in taking a stab at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants