调至内容部分
创建账户
或
登录
Stripe 文档徽标
/
询问人工智能
创建账户
登录
开始
付款
销售收入
平台和交易市场
资金管理
开发人员资源
概览
版本管理
更改日志
升级您的 API 版本
升级 SDK 版本
基础功能
SDK
API
测试
Stripe CLI
项目示例
工具
Workbench
开发人员管理平台
Stripe Shell
Stripe for Visual Studio Code
功能
工作流程
事件接收端
Stripe 健康警报文件上传
AI 解决方案
代理工具包
模型上下文协议
安全与隐私
安全
Stripebot web crawler
隐私
扩展 Stripe
构建 Stripe 应用程序
    概览
    开始
    创建应用程序
    Stripe Apps 的原理
    示例应用程序
    构建应用
    存储密钥
    API 认证方法
    授权流程
    服务器端逻辑
    侦听事件
    处理不同模式
    启用沙盒支持
    应用设置页面
    构建 UI
    轻松入驻
    发布您的应用
    分发选择
    上传您的应用
    版本与发布
    测试您的应用
    发布您的应用
    推广您的应用
    添加深度链接
    创建安装链接
    在 UI 扩展中分配角色
    安装后操作
    应用程序分析
    嵌入式组件
    嵌入第三方 Stripe 应用
    迁移到 Stripe 应用
    迁移或构建扩展
    将插件迁移到 Stripe 应用程序或 Stripe Connect
    参考编号
    应用描述文件
    CLI
    扩展 SDK
    权限
    视口
    设计样式
    组件
      手风琴
      徽标
      横幅
      柱形图
      箱子
      按钮
      ButtonGroup
      复选框
      芯片
      ContextView
      数据字段
      分配器
      FocusView
      FormFieldGroup
      图标
      图片
      内联
      折线图
      Link
      列表
      菜单
      OnboardingView
      PropertyList
      收音机
      选择
      SettingsView
      SignInView
      Sparkline
      纺纱机
      切换
      表格
      标签
      任务列表
      文本区域
      文本字段
      Toast
      提示框
使用 Stripe 的应用程序
合作伙伴
合作伙伴生态
合作伙伴认证
首页开发人员资源Build Stripe appsComponents

Banner component for Stripe Apps

Use the Banner to show a variety of alerts or messages you want to make explicit to the user.

To add the Banner component to your app:

import {Banner} from '@stripe/ui-extension-sdk/ui';

Overview

Banners take up the width of their parent container. Banners are suitable for important information requiring user input and persistent display.

Banners come with three preset types:

  • Default
  • Caution
  • Critical

The following shows a preview of the three preset types for a banner:

正在加载示例...
<Box css={{stack: 'y', gap: 'medium', width: 'fill'}}> <Banner type="default" onDismiss={() => console.log('hello world')} title="Neutral title" description="A short description" actions={ <Button onPress={() => console.log('hello world')}>Button</Button> } /> <Banner type="caution" title="Check your bank details" description="Your bank account information must be verified before receiving payouts." onDismiss={() => console.log('hello world')} actions={ <Box css={{stack: 'x', gap: 'small'}}> <Button onPress={() => console.log('hello world')}> Update bank account </Button> <Button onPress={() => console.log('hello world')}> Learn more </Button> </Box> } /> <Banner type="critical" title="Check your bank details" description="Your bank account information must be verified before receiving payouts." actions={ <Button onPress={() => console.log('hello world')}> Update bank account </Button> } /> </Box>

Banner props

PropertyType

actions

Optional

React.ReactNode

description

Optional

React.ReactNode

onDismiss

Optional

(() => void) | undefined

title

Optional

React.ReactNode

type

Optional

("default" | "caution" | "critical") | undefined

onDismiss

Banners have the option of adding a dismiss button—add a click handler to onDismiss for the Hide Banner button to appear:

正在加载示例...
const [open, setOpen] = React.useState(true); return ( <Box css={{stack: 'y', gap: 'medium', width: 'fill'}}> <Button onPress={() => setOpen(!open)}> {open ? 'Hide' : 'Show'} Banner </Button> {open && ( <Banner type="default" onDismiss={() => setOpen(false)} title="Neutral title" description="A short description" actions={ <Button onPress={() => console.log('hello world')}>Button</Button> } /> )} </Box> )

Actions

Banners also take an actions prop that allows you to add action buttons to the Banner:

正在加载示例...
<Box css={{width: 'fill'}}> <Banner type="default" title="Check your bank details" description="Your bank account information must be verified before receiving payouts." actions={ <Button onPress={() => console.log('hello world')}> Update bank account </Button> } /> </Box>

另见

  • Design patterns to follow
  • Style your app
  • UI testing
此页面的内容有帮助吗?
是否
  • 需要帮助?联系支持。
  • 加入我们的早期使用计划。
  • 查看我们的更改日志。
  • 有问题?联系销售。
  • LLM? Read llms.txt.
  • Powered by Markdoc