我在哪里可以找到 styled-components 支持的每个组件的允许道具或属性列表
where can I find the list of allowable props or attributes for each component supported by styled-components
从我们的 React 开始,很容易找到展示如何开始使用 React 和样式化组件的教程。我发现这很容易,但很难获得我想要的样式,因为我找不到显示样式组件的允许列表以及允许属性或值的内部列表的等效字典。
例如(仅)button 组件非常常见,但是文档的 none 显示了 type[ 的允许值=26=]属性。你怎么知道 type 属性存在,然后知道只有三个允许值 button|onsubmit|reset.
任何人都可以为我指出 React 中使用的样式化组件的有用字典或备忘单。
您似乎无法通过 vs code 中的 typescript 自动完成方法找到选项。
我意识到 styled-components 在 javascript 和 html 和 css 之上是一个非常有用的层,但是是否有一个相关且完整的允许值和组件的字典 - 它styled-components 文档中似乎不存在。
样式化组件值的参考文档的缺乏让我作为一个新手很难。
虽然 styled-components
包装了 CSS 代码,但它没有预定义的组件。
Utilising tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components. It also removes the mapping between components and styles – using components as a low-level styling construct could not be easier!
有关所有 HTML 元素及其属性的列表,请参阅 MDN HTML elements reference。
此外,如果您对自定义组件进行样式设置,则应在相应的文档中了解其属性(如果该组件来自库),或者使用 PropTypes
, Flow
or TypeScript
.
从我们的 React 开始,很容易找到展示如何开始使用 React 和样式化组件的教程。我发现这很容易,但很难获得我想要的样式,因为我找不到显示样式组件的允许列表以及允许属性或值的内部列表的等效字典。
例如(仅)button 组件非常常见,但是文档的 none 显示了 type[ 的允许值=26=]属性。你怎么知道 type 属性存在,然后知道只有三个允许值 button|onsubmit|reset.
任何人都可以为我指出 React 中使用的样式化组件的有用字典或备忘单。
您似乎无法通过 vs code 中的 typescript 自动完成方法找到选项。
我意识到 styled-components 在 javascript 和 html 和 css 之上是一个非常有用的层,但是是否有一个相关且完整的允许值和组件的字典 - 它styled-components 文档中似乎不存在。
样式化组件值的参考文档的缺乏让我作为一个新手很难。
虽然 styled-components
包装了 CSS 代码,但它没有预定义的组件。
Utilising tagged template literals (a recent addition to JavaScript) and the power of CSS, styled-components allows you to write actual CSS code to style your components. It also removes the mapping between components and styles – using components as a low-level styling construct could not be easier!
有关所有 HTML 元素及其属性的列表,请参阅 MDN HTML elements reference。
此外,如果您对自定义组件进行样式设置,则应在相应的文档中了解其属性(如果该组件来自库),或者使用 PropTypes
, Flow
or TypeScript
.