You can either use SCSS/CSS overrides to control the b-card layout, or extend/wrap the component to default the props you want:
import { BCard } from 'bootstrap-vue'
export default {
name 'MyCard',
// Create as a functional component wrapper
functional: true,
// define our props (borrow from BCard)
props: {
...BCard.props,
},
render(h, { props, data, children }) {
return h(
BCard,
{
props: {
// Pass all props to BCard
...props,
// Override the following prop defaults (if not provided)
headerBgVariant: props.headerBgVariant || 'primary',
headerTextVariant: props.headerBgVariant || 'white'
},
// Pass any additional (optional) attributes down
attrs: data.attrs,
// Set the style
style: {
// merge in any styles manually applied
...data.style,
// Set the max-width if not explicitly set
maxWidth: data.style.maxWidth || '40rem'
}
}
)
}
}
For more info on functional components and render functions, see https://v2.vuejs.org/v2/guide/render-function.html#Functional-Components
For handling more complex data merges with functional components, check out https://github.com/alexsasharegan/vue-functional-data-merge
.card { max-width: 40rem }b-card, which passes the default slot tob-cardand applies the preferred props/styles tob-card