React Callout Component
React callout component provides presentation of content in a visually distinct manner. Includes a heading, icon and typically text-based content.
Other frameworks
CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.
Examples#
Callout component is prepared for any length of text, as well as an optional elements like icons, headings, etc. For a styling, use one of the required contextual props (e.g., color="success"
).
<CCallout color="primary"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="secondary"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="success"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="danger"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="warning"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="info"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="light"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout><CCallout color="dark"> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.</CCallout>
Conveying meaning to assistive technologies
Using color to add meaning only provides a visual indication, which will not be conveyed to
users of assistive technologies – such as screen readers. Ensure that information denoted by the
color is either obvious from the content itself (e.g. the visible text), or is included through
alternative means, such as additional text hidden with the .visually-hidden
class.
Customizing#
CSS variables#
React callouts use local CSS variables on .callout
for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
--cui-callout-padding-x: #{$callout-padding-x};--cui-callout-padding-y: #{$callout-padding-y};--cui-callout-margin-x: #{$callout-margin-x};--cui-callout-margin-y: #{$callout-margin-y};--cui-callout-border-width: #{$callout-border-width};--cui-callout-border-color: #{$callout-border-color};--cui-callout-border-left-width: #{$callout-border-left-width};--cui-callout-border-radius: #{$callout-border-radius};
How to use CSS variables#
const vars = { '--my-css-var': 10, '--my-another-css-var': "red" }return <CCallout style={vars}>...</CCallout>
SASS variables#
$callout-padding-y: $spacer !default;$callout-padding-x: $spacer !default;$callout-margin-y: $spacer !default;$callout-margin-x: 0 !default;$callout-border-radius: var(--cui-border-radius) !default;$callout-border-width: var(--cui-border-width) !default;$callout-border-color: var(--cui-border-color) !default;$callout-border-left-width: calc($callout-border-width * 4) !default; // stylelint-disable-line function-disallowed-list
$callout-variants: ( "primary": $primary, "secondary": $secondary, "success": $success, "danger": $danger, "warning": $warning, "info": $info, "light": $light, "dark": $dark) !default;
API#
CCallout#
import { CCallout } from '@coreui/react'// orimport CCallout from '@coreui/react/src/components/callout/CCallout'
Property | Description | Type | Default |
---|---|---|---|
className | A string of all className you want applied to the base component. | string | - |
color | Sets the color context of the component to one of CoreUI’s themed colors. | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light' | string | - |