- Tags 和属性
- 支持的 Tags
- HTML 元素
- SVG 元素
- 支持的属性
- HTML 属性
- SVG 属性
- 支持的 Tags
Tags 和属性
支持的 Tags
React 试着支持所有常见的元素。如果你需要一个没有列在这里的元素,请 file an issue。
HTML 元素
下面的 HTML 是被支持的:
a abbr address area article aside audio b base bdi bdo big blockquote body brbutton canvas caption cite code col colgroup data datalist dd del details dfndialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5h6 head header hr html i iframe img input ins kbd keygen label legend li linkmain map mark menu menuitem meta meter nav noscript object ol optgroup optionoutput p param picture pre progress q rp rt ruby s samp script section selectsmall source span strong style sub summary sup table tbody td textarea tfoot ththead time title tr track u ul var video wbr
SVG 元素
下面的 SVG 元素是被支持的:
circle clipPath defs ellipse g line linearGradient mask path pattern polygon polylineradialGradient rect stop svg text tspan
你也许对 react-art有兴趣,一个让React绘制Canvas, SVG, 或者 VML (for IE8) 的绘制库.
支持的属性
React支持所有的 data-* 和 aria-* 以及下列的属性.
注意:
所有的属性都是 camel-cased ,
class和for分别是className和htmlFor,来符合DOM API 规范.
关于事件的列表,见 Supported Events.
HTML 属性
下面的标准属性是被支持的:
accept acceptCharset accessKey action allowFullScreen allowTransparency altasync autoComplete autoFocus autoPlay capture cellPadding cellSpacing charSetchallenge checked classID className cols colSpan content contentEditable contextMenucontrols coords crossOrigin data dateTime defer dir disabled download draggableencType form formAction formEncType formMethod formNoValidate formTarget frameBorderheaders height hidden high href hrefLang htmlFor httpEquiv icon id inputModekeyParams keyType label lang list loop low manifest marginHeight marginWidth maxmaxLength media mediaGroup method min minLength multiple muted name noValidate openoptimum pattern placeholder poster preload radioGroup readOnly rel required rolerows rowSpan sandbox scope scoped scrolling seamless selected shape size sizesspan spellCheck src srcDoc srcSet start step style summary tabIndex target titletype useMap value width wmode wrap
另外,支持下面的非标准属性:
autoCapitalize autoCorrectfor Mobile Safari.propertyfor Open Graph meta tags.itemProp itemScope itemType itemRef itemIDfor HTML5 microdata.unselectablefor Internet Explorer.results autoSavefor WebKit/Blink input fields of typesearch.
同样有React规范的属性 dangerouslySetInnerHTML (more here),用于直接插入HTML字符串到组件里.
SVG 属性
clipPath cx cy d dx dy fill fillOpacity fontFamilyfontSize fx fy gradientTransform gradientUnits markerEndmarkerMid markerStart offset opacity patternContentUnitspatternUnits points preserveAspectRatio r rx ry spreadMethodstopColor stopOpacity stroke strokeDasharray strokeLinecapstrokeOpacity strokeWidth textAnchor transform versionviewBox x1 x2 x xlinkActuate xlinkArcrole xlinkHref xlinkRolexlinkShow xlinkTitle xlinkType xmlBase xmlLang xmlSpace y1 y2 y
