Skip to content

Commit be50697

Browse files
levimeahanljharb
authored andcommitted
[Docs] Explicit React CSS selector syntax description
It is not obvious on reading through the document as-is that the CSS selector syntax works on React component names and their props. While it can be inferred through reading "The Key and Ref Props" section, that section can easily be missed when someone is specifically looking at the lists and examples of selectors to see what can be used. It is much clearer to explicitly state this syntax works on React components.
1 parent d9cc09e commit be50697

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/api/selector.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ follows:
1313
- id syntax (`#foo`, `#foo-bar`, etc.)
1414
- attribute syntax (`[href="foo"]`, `[type="text"]`, and the other attribute selectors listed [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Introduction_to_CSS/Attribute_selectors).)
1515
- universal syntax (`*`)
16+
- React component name and props (`Button`, `Button[type="submit"]`, etc) - however, please note that it is strongly encouraged to find by component constructor/function and not by display name.
1617

1718
The attribute syntax also works by value, rather than by string. Strings, numbers, and boolean property values are supported. Example:
1819

@@ -40,7 +41,7 @@ a[href="foo"]
4041
.foo input
4142
```
4243

43-
**The Key and Ref Props**
44+
**React Key and Ref Props**
4445

4546
While in most cases, any React prop can be used, there are exceptions.
4647
The `key` and `ref` props will never work; React uses these props internally.

0 commit comments

Comments
 (0)