File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change
1
+ < Row className = "mx-0" >
2
+ < Button as = { Col } variant = "primary" > Button #1</ Button >
3
+ < Button as = { Col } variant = "secondary" className = "mx-2" > Button #2</ Button >
4
+ < Button as = { Col } variant = "success" > Button #3</ Button >
5
+ </ Row > ;
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import CodeBlock from '../../components/CodeBlock';
3
3
import BrowserGlobalsCodeBlock from ' ../../components/BrowserGlobalsCodeBlock' ;
4
4
import CssCodeBlock from ' ../../components/CssCodeBlock' ;
5
5
import DocLink from ' ../../components/DocLink' ;
6
+ import ReactPlayground from ' ../../components/ReactPlayground' ;
7
+ import AsPropButtonExample from ' ../../examples/AsProp' ;
6
8
7
9
# Introduction
8
10
@@ -118,6 +120,21 @@ $theme-colors: (
118
120
See [ the Bootstrap docs] ( https://getbootstrap.com/docs/4.4/getting-started/theming/ )
119
121
for more advanced use cases and details about customizing stylesheets.
120
122
123
+ ## "as" Prop API
124
+
125
+ With certain React-Bootstrap components, you may want to modify the component or HTML tag
126
+ that is rendered.
127
+
128
+ If you want to keep all the styling of a particular React-Bootstrap component but switch the
129
+ component that is finally rendered (whether it's a different React-Bootstrap component, a
130
+ different custom component, or a different HTML tag) you can use the "as" Prop to do so.
131
+
132
+ The example below passes a Column component to the "as" Prop in a Button component. This
133
+ ultimately causes a Column component to be rendered but with the same styles as a Button
134
+ component.
135
+
136
+ <ReactPlayground codeText = { AsPropButtonExample } />
137
+
121
138
## Themes
122
139
123
140
React-Bootstrap is compatible with existing Bootstrap themes. Just
You can’t perform that action at this time.
0 commit comments