You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-5Lines changed: 35 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
# Better rounded corners
2
+
2
3
*for HTML divs in React.js*
3
4
4
-
`react-round-div` makes your rounded rectangles look smoother for a more pleasant feel. With a simple and easy integration into your code you have to do almost nothing to up the style of your project.
5
+
`react-round-div` makes your rounded rectangles look smoother for a more pleasant feel. With a simple and easy
6
+
integration into your code you have to do almost nothing to up the style of your project.
5
7
6
8
Here is a very clear demonstration of these smooth corners:
7
9
@@ -14,7 +16,10 @@ npm i react-round-div
14
16
```
15
17
16
18
## Usage
17
-
Simply import the package and replace any divs with rounded corners (`border-radius`) that you want to improve. `react-round-div` will handle the rest.
19
+
20
+
Simply import the package and replace any divs with rounded corners (`border-radius`) that you want to
21
+
improve. `react-round-div` will handle the rest.
22
+
18
23
```jsx
19
24
importRoundDivfrom'react-round-div';
20
25
@@ -29,8 +34,33 @@ const App = () => {
29
34
exportdefaultApp;
30
35
```
31
36
37
+
### Options
38
+
39
+
#### `dontConvertShadow`
40
+
41
+
If you have set a `box-shadow` in your CSS, `react-round-div` will convert it to
42
+
a [`drop-shadow()`](https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/drop-shadow()). This happens
43
+
because otherwise, the old rounded corners may shine through. If you want `react-round-div` to not convert
44
+
your `box-shadow`s, add the `dontConvertShadow` option:
45
+
46
+
```jsx
47
+
<RoundDiv dontConvertShadow>
48
+
<p>Content</p>
49
+
</RoundDiv>
50
+
```
51
+
52
+
## Things to note & caveats
53
+
54
+
This package is still in the starting blocks, so for now borders are only supported in the `solid` style and transitions
55
+
and animations on the div may not work properly.
56
+
57
+
There are a couple of css properties, that you can't reliably set with `RoundDiv`:
32
58
33
-
## Caveats
34
-
This package is still in the starting blocks, so for now borders are only supported in the `solid` style and some transitions on the div may not work properly.
59
+
- the `background` property and all the properties it is a shorthand for
60
+
-`border-color`
61
+
-`box-shadow`
62
+
-`filter`, if you haven't set [`dontConvertShadow`](#dontconvertshadow)
35
63
36
-
Moreover, children inside `RoundDiv` get cut off when are placed (partly) outside the div due to `clip-path` being used to make the smooth corners. There will probably an option in later versions to use a pseudo-element for the shape, so that children can be rendered outside.
64
+
You shouldn't set these properties inline. Instead, set them in a stylesheet. This may change in future versions.
65
+
The `filter` property in particular will not work at all, if you have set a `box-shadow` AND have not
66
+
set [`dontConvertShadow`](#dontconvertshadow). This may also change in future versions.
0 commit comments