- Welcome
- Getting started
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- Code
- Content Cards
- Data Table
- Datepicker
- Description List
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat List
- Flight Leg
- Floating Action Button
- Floating Notification
- Form Label
- Form Validation
- Graphic Promotion
- Horizontal Navigation
- Icon
- Image
- Infinite Scroll
- Link
- List
- Map
- Mobile Scroll Container
- Modal
- Navigation Bar
- Nudger
- Overlay
- Page Indicator
- Pagination
- Panel
- Phone Input
- Picker
- Popover
- Price
- Progress Bar
- Radio Button
- Rating
- Scrollable Calendar
- Section List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- Spinner
- Split Input
- Star Rating
- Switch
- Table
- Text
- Text Input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable Native Feedback
- Touchable Overlay
- Content
- Accessibility
Code
The code component can be used to format a piece of text or entire text block as code.
Default
Use BpkCode for inline code blocks.
Alternate
Use the alternate prop for displaying on dark backgrounds.
Block
For a block of code, use BpkCodeBlock.
Block alternate
Use the alternate prop for displaying on dark backgrounds.
bpk-component-code
Backpack code component.
Installation
Check the main Readme for a complete installation guide.
Usage
import { BpkCode, BpkCodeBlock } from '@skyscanner/backpack-web/bpk-component-code';
import BpkText from '@skyscanner/backpack-web/bpk-component-text';
const codeBlock = `import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(<App />, ...);`;
export default () => (
<div>
<BpkText tagName='p'>
We recommend using React from npm with a bundler like webpack. You can use
the <BpkCode>react</BpkCode> and <BpkCode>react-dom</BpkCode> packages. After installing it
using <BpkCode>npm install --save react react-dom</BpkCode>, you can use:
</BpkText>
<BpkCodeBlock>{codeBlock}</BpkCodeBlock>
</div>
);
Props
For BpkCode & BpkCodeBlock:
Property | PropType | Required | Default Value |
---|---|---|---|
children | Node | true | - |
alternate | bool | false | false |
className | string | false | null |
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Nov 16, 2022, 17:28