Skip to content

Commit b99a277

Browse files
committed
Fix issue with caption on bootstrap 4
Add new prop to check if bootstrap is used Update component in order to return a custom caption when bootstrap4 is in use
1 parent 1d13565 commit b99a277

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react-bootstrap-table2/src/caption.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@ import PropTypes from 'prop-types';
44

55
const Caption = (props) => {
66
if (!props.children) return null;
7-
return (
8-
<caption>{ props.children }</caption>
7+
8+
const caption = props.bootstrap4 ? (
9+
<caption style={ { captionSide: 'top' } }>{props.children}</caption>
10+
) : (
11+
<caption>{props.children}</caption>
912
);
13+
14+
return caption;
1015
};
1116

1217
Caption.propTypes = {
1318
children: PropTypes.oneOfType([
1419
PropTypes.node,
1520
PropTypes.string
16-
])
21+
]),
22+
bootstrap4: PropTypes.bool
1723
};
1824

1925
export default Caption;

0 commit comments

Comments
 (0)