--- localeCode: en-US order: 65 category: Feedback title: Banner subTitle: Banner icon: doc-banner dir: column brief: The Banner component is usually used to identify the status or notification of the full page. It is usually resident and requires the user to close it initiatively. --- ## Demos ### How to import ```jsx import import { Banner } from '@douyinfe/semi-ui'; ``` ### Basic Usage ```jsx live=true dir="column" import React, { useState } from 'react'; import { Banner, Layout, Button } from '@douyinfe/semi-ui'; () => { const [visible, setVisible] = useState(false); const changeVisible = () => { setVisible(!visible); }; const { Header, Footer, Content } = Layout; const banner = ( ); return ( <>
Header
{visible? banner : null} Content
Footer
); }; ``` ### Types The `type` prop supports one of: `default`(default),`danger`,`warning`, `success`. ```jsx live=true dir="column" import React from 'react'; import { Banner } from '@douyinfe/semi-ui'; () => ( <>


); ``` ### Use in Container You could set `fullMode={false}` to use style for non-fullscreen mode。 Also, use `bordered` for bordered style. ```jsx live=true dir="column" import React from 'react'; import { Banner, Typography } from '@douyinfe/semi-ui'; function Demo() { const { Text } = Typography; return (
{`Don't know AppKey?`}
} description={
You can contact the corresponding R & D students to confirm whether you have applied for an application on the application cloud platform , and fill in the corresponding information.
} />
{`Don't know AppKey?`}} description={
You can contact the corresponding R & D students to confirm whether you have applied for an application on the application cloud platform , and fill in the corresponding information.
} />
{`Don't know AppKey?`}} description={
You can contact the corresponding R & D students to confirm whether you have applied for an application on the application cloud platform , and fill in the corresponding information.
} />
{`Don't know AppKey?`}} description={
You can contact the corresponding R & D students to confirm whether you have applied for an application on the application cloud platform , and fill in the corresponding information.
} /> ); } ``` ```css .components-banner-demo { .semi-banner-info.semi-banner-bordered { border: 1px solid var(--semi-color-primary-disabled); } .semi-banner-warning.semi-banner-bordered { border: 1px solid var(--semi-color-warning-light-active); } .semi-banner-danger.semi-banner-bordered { border: 1px solid var(--semi-color-danger-light-active); } .semi-banner-success.semi-banner-bordered { border: 1px solid var(--semi-color-success-light-active); } } ``` ### Customized Content Use `children` to create customized content. ```jsx live=true dir="column" import React from 'react'; import { Banner } from '@douyinfe/semi-ui'; () => (

); ``` ## API Reference | Properties | Instructions | Type | Default | Version | | ---------- | ---------------------------------------------------------------------------------------- | -------- | --------------------- | --- | | bordered | Toggle if show border, only affects in non-fullscreen mode | boolean | false | 1.0 | | className | Classname | string | - |- | | closeIcon | Custom close icon,no icon if passed null | ReactNode | - | 1.0 | | description | Description texts | ReactNode | - | 1.0 | | fullMode| Toggle if banner is full screen | boolean | true | 1.0 | | icon | Custom icon, no icon if passed null | ReactNode | - | 1.0 | | onClose | Callback function when close banner | function | - |- | | style | Style | object | - |- | | title | Title | ReactNode | - | 1.0 | | type | Type of banner, one of `info`, `success`, `danger`, `warning` | string | `info` | - | ## Accessibility ### ARIA - The component has a `role` of 'alert'. - The close icon has a `aria-label` of 'Close'. ### Keyboard and Focus - The close button of the Banner can be focused with the `Tab` key. After the button is focused, hit the `Enter` key or the `Space` key to close the banner. ## Content Guidelines - Full screen Banner - Try to keep the content displayed completely on one line - Use correct punctuation, commas within sentences and periods between sentences - Non-fullscreen Banner - title - Instructions in condensed language - Try to avoid using commas, periods and other punctuation marks in the title, and support the use of question marks at the end when there are and only interrogative sentences - text - On the premise of complete information transmission, try to compress the text to 1-2 sentences - A detailed description or explanation of the title, rather than a repetition of the title - Use correct punctuation, commas within sentences and periods between sentences ## Design Tokens