### ButtonLink With Icons Example Source: https://github.com/backstage/docs-ui/blob/main/components/button-link.html Demonstrates how to add start and end icons to ButtonLink using the iconStart and iconEnd props. The example includes three buttons: one with a start icon, one with an end icon, and one with both. ```tsx } href="https://ui.backstage.io" target="_blank"> Button } href="https://ui.backstage.io" target="_blank"> Button } iconEnd={} href="https://ui.backstage.io" target="_blank" > Button ``` -------------------------------- ### Icons and text example Source: https://github.com/backstage/docs-ui/blob/main/components/toggle-button-group.html Example showing toggle buttons with icons and text. Imports icons from '@remixicon/react' and uses iconStart/iconEnd props. ```jsx import { RiCloudLine, RiStarFill, RiStarLine, RiArrowRightSLine } from '@remixicon/react'; } /> } /> }> Star }> Next ``` -------------------------------- ### URL-based navigation example Source: https://github.com/backstage/docs-ui/blob/main/components/tabs/__next._full.txt Example showing how to use the href prop on Tab to enable URL-based tab selection. ```tsx import { Tabs, TabList, Tab, TabPanel } from '@backstage/core-components'; const Example = () => ( ``` -------------------------------- ### Import and Basic TooltipTrigger Example Source: https://github.com/backstage/docs-ui/blob/main/components/tooltip/__next._full.txt Shows the required import from '@backstage/ui' and the same basic TooltipTrigger example. Use this when you need the import statement included. ```tsx import { TooltipTrigger, Tooltip, Button } from '@backstage/ui'; Helpful information ``` -------------------------------- ### Example with rich content Source: https://github.com/backstage/docs-ui/blob/main/components/search-autocomplete.html Example showing how to render items with a title and description. Uses a fruits array and filters based on input value. Demonstrates custom item content with Text components. ```jsx const fruits = [ { id: 'apple', name: 'Apple', description: 'A round fruit' }, { id: 'banana', name: 'Banana', description: 'A yellow curved fruit' }, { id: 'cherry', name: 'Cherry', description: 'A small red stone fruit' }, ]; function Example() { const [inputValue, setInputValue] = useState(''); const filtered = fruits.filter(fruit => fruit.name.toLowerCase().includes(inputValue.toLowerCase()), ); return ( {filtered.map(fruit => ( {fruit.name} {fruit.description} ))} ); } ``` -------------------------------- ### Vertical orientation example Source: https://github.com/backstage/docs-ui/blob/main/components/tabs/__next._full.txt Example showing how to use the orientation prop to display tabs vertically. ```tsx import { Tabs, TabList, Tab, TabPanel } from '@backstage/core-components'; const Example = () => ( Overview Details Overview content Details content ); ``` -------------------------------- ### Grid usage example Source: https://github.com/backstage/docs-ui/blob/main/components/grid.html Import Grid from '@backstage/ui' and use Grid.Root with columns and gap props to create a grid container. The example shows three items inside the grid. ```jsx import { Grid } from '@backstage/ui';
Item 1
Item 2
Item 3
``` -------------------------------- ### Flex with alignment examples Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next.components.flex.__PAGE__.txt Examples of Flex alignment using the align prop. ```tsx import { Flex } from '@backstage/core-components';
Item
Item
Item
``` -------------------------------- ### TextField sizes example Source: https://github.com/backstage/docs-ui/blob/main/components/text-field.html Shows how to render TextField in small and medium sizes using the size prop. The example uses a Flex container with gap="4" and includes an icon prop with RiSparklingLine. ```jsx } /> } /> ``` -------------------------------- ### Menu Component Example Source: https://github.com/backstage/docs-ui/blob/main/components/menu.html Example of a menu with trigger, button, section, and items. Use this to create a basic dropdown menu with a trigger button and menu items. ```jsx New Open ``` -------------------------------- ### ButtonLink Sizes Example Source: https://github.com/backstage/docs-ui/blob/main/components/button-link.html Shows how to render ButtonLink components in small and medium sizes using the size prop. The example uses a Flex container to align the buttons horizontally. ```tsx Small Medium ``` -------------------------------- ### Use Flex, Text, and Button Components Source: https://github.com/backstage/docs-ui/blob/main/get-started/installation/__next._full.txt Example of using Flex, Text, and Button components from '@backstage/ui'. ```tsx import { Flex, Button, Text } from '@backstage/ui'; Hello World ; ``` -------------------------------- ### Flex with direction examples Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next.components.flex.__PAGE__.txt Examples of Flex direction using the direction prop. ```tsx import { Flex } from '@backstage/core-components';
Item 1
Item 2
Item 1
Item 2
``` -------------------------------- ### Import and use useBgProvider and useBgConsumer Source: https://github.com/backstage/docs-ui/blob/main/components/button-icon.txt Shows how to replace useSurface and SurfaceProvider with useBgProvider and useBgConsumer from '@backstage/ui'. The example includes a diff-style change where the import statement is updated and the useBgProvider hook is used to get the 'bg' property. ```typescript - import { useSurface, SurfaceProvider } from '@backstage/ui'; + import { useBgProvider, useBgConsumer, BgProvider } from '@backstage/ui'; - const { surface } = useSurface({ onSurface: props.onSurface }); + const { bg } = useBgProvider(props.bg); ``` -------------------------------- ### Select with search and options Source: https://github.com/backstage/docs-ui/blob/main/components/select/__next.components.select.__PAGE__.txt Example of a Select component with a search placeholder and a list of options for countries. ```jsx ``` -------------------------------- ### List with icons example Source: https://github.com/backstage/docs-ui/blob/main/components/list/__next.components.list.__PAGE__.txt Example of a List component with an aria-label and items prop, rendering a list of programming languages with icons. ```tsx {item => ( ``` -------------------------------- ### Combobox with icon and options Source: https://github.com/backstage/docs-ui/blob/main/components/combobox/__next._full.txt Example of a Combobox with an icon, label, and options prop. ```jsx } options={[ ... ]} /> ``` -------------------------------- ### Migration: Box to DecorativeBox Source: https://github.com/backstage/docs-ui/blob/main/components/grid/__next._full.txt Shows the before and after of migrating from Box to DecorativeBox for a neutral background. The 'Before' example uses Box with bg="neutral-2", and the 'After' example uses DecorativeBox with bg="neutral". ```jsx // Before ... // After ... ``` -------------------------------- ### Hidden headings example Source: https://github.com/backstage/docs-ui/blob/main/components/visually-hidden.html Example showing how to hide a heading while keeping it accessible, using VisuallyHidden with Flex and Text components. ```tsx Footer links About us Jobs Terms and Conditions ``` -------------------------------- ### Tooltip placement examples Source: https://github.com/backstage/docs-ui/blob/main/components/tooltip/__next._full.txt Shows Tooltip components with placement props 'top', 'bottom', and 'left' wrapped in TooltipTrigger components, each containing a Button. The example demonstrates how to position tooltips relative to trigger elements. ```tsx Top tooltip Bottom tooltip Left tooltip ``` -------------------------------- ### CardFooter migration before/after Source: https://github.com/backstage/docs-ui/blob/main/components/card.html Shows the before and after usage of CardFooter when migrating to the new Box-based API. The before example uses CardFooter with a bg prop, while the after example replaces it with Box bg="neutral". ```jsx // Before ... ``` ```jsx // After ... ``` -------------------------------- ### Menu with MenuItem and MenuTrigger Source: https://github.com/backstage/docs-ui/blob/main/components/menu.html Example showing a menu with menu items and a trigger button. ```tsx Option 1 Option 2 Option 3 ``` -------------------------------- ### Import and Use Accordion from '@backstage/ui' Source: https://github.com/backstage/docs-ui/blob/main/components/accordion/__next.components.accordion.__PAGE__.txt Example showing the required import from '@backstage/ui' and a minimal Accordion with a trigger and panel. The panel contains plain text content. ```tsx import { Accordion, AccordionTrigger, AccordionPanel } from '@backstage/ui'; Your content ``` -------------------------------- ### ColumnConfig array definition Source: https://github.com/backstage/docs-ui/blob/main/changelog.txt Defines a typed array of ColumnConfig objects for a table, with an example column configuration. The snippet shows the start of a column definition with an id and label. ```typescript const columns: ColumnConfig[] = [ { id: 'name', label: 'Name', ``` -------------------------------- ### Before and After: Box vs Flex layout Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next._full.txt This snippet shows a before and after comparison of using Box with background color versus using Flex for layout. The 'Before' example uses a Box with bg="neutral-2", and the 'After' example uses a Flex container with a Box inside. ```jsx // Before ... // After Start Middle End ``` -------------------------------- ### DateRangePicker with default value Source: https://github.com/backstage/docs-ui/blob/main/components/date-range-picker/__next.components.date-range-picker.__PAGE__.txt Shows how to set a default value for the DateRangePicker using parseDate from '@internationalized/date'. The example sets the start date to '2025-02-03' and the end date to '2025-02-14'. ```tsx import { parseDate } from '@internationalized/date'; ``` -------------------------------- ### Creating a custom card using BUI components Source: https://github.com/backstage/docs-ui/blob/main/index.html Shows how to create a custom card using BUI components. The example includes a div with a style that sets the background color to 'var(--bui-bg-solid)' and contains the text 'Hello World'. ```html
Hello World
``` -------------------------------- ### Flex with responsive props Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next.components.flex.__PAGE__.txt Example of Flex using responsive props for different breakpoints. ```tsx import { Flex } from '@backstage/core-components';
Item 1
Item 2
``` -------------------------------- ### Box usage example Source: https://github.com/backstage/docs-ui/blob/main/components/box.html Basic usage of the Box component with padding, background surface, and content. ```jsx import { Box } from '@backstage/ui'; Content with padding and background ``` -------------------------------- ### TooltipTrigger Inside Flex with Gap Source: https://github.com/backstage/docs-ui/blob/main/components/tooltip/__next._full.txt Starts a Flex container with gap 4 and a TooltipTrigger wrapping a Button labeled 'Top'. The example is truncated in the source; only the visible lines are included. ```tsx ``` -------------------------------- ### Flex with align, justify, and gap Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next._full.txt Use this snippet to create a flex container with centered alignment, space-between justification, and a gap of 4. The example includes a DecorativeBox for the start and end elements. ```jsx Start Middle End ``` -------------------------------- ### Select with options and search filter Source: https://github.com/backstage/docs-ui/blob/main/components/select/__next._full.txt Example of a Select component with a label, options, and a search placeholder. The filter function filters options by checking if the option label starts with the search query (case-insensitive). ```jsx { { id: 'uk', label: 'United Kingdom' }, { id: 'fr', label: 'France' }, { id: 'de', label: 'Germany' }, // ... more options ]} /> ``` ```jsx ``` ```jsx ``` -------------------------------- ### Button size large example Source: https://github.com/backstage/docs-ui/blob/main/components/button/__next._full.txt Example of a Button component with the size prop set to 'large'. ```jsx ``` -------------------------------- ### Creating a custom component using BUI tokens Source: https://github.com/backstage/docs-ui/blob/main/index.html Shows how to create a custom component using BUI tokens. The example imports ColorPicker, ColorArea, and ColorSlider from a BUI library. ```javascript import { ColorPicker, ColorArea, ColorSlider } from '...' ``` -------------------------------- ### Icons only example Source: https://github.com/backstage/docs-ui/blob/main/components/toggle-button-group.html Example of toggle buttons with only icons, using aria-label for accessibility. Imports icons from '@remixicon/react'. ```jsx import { RiCloudLine, RiStarLine, RiArrowRightSLine } from '@remixicon/react'; } /> } /> } /> ``` -------------------------------- ### TextAreaField usage example Source: https://github.com/backstage/docs-ui/blob/main/components/text-area-field/__next._full.txt Example of using the TextAreaField component with name, placeholder, label, and description props. ```tsx name="message" placeholder="Enter a message" label="Message" description="Share as much detail as you like." /> ``` -------------------------------- ### Menu with MenuTrigger and MenuItem Source: https://github.com/backstage/docs-ui/blob/main/components/menu.html Example showing a menu with a trigger button and menu items, including a link item. ```jsx Home About ``` -------------------------------- ### Default selected tab example Source: https://github.com/backstage/docs-ui/blob/main/components/tabs/__next._full.txt Example showing how to set a default selected tab in the Tabs component. ```tsx import { Tabs, TabList, Tab, TabPanel } from '@backstage/core-components'; const Example = () => ( Overview Details Overview content Details content ); ``` -------------------------------- ### Button with iconStart and size Source: https://github.com/backstage/docs-ui/blob/main/components/button.html Shows a Button with an iconStart prop and size set to 'small'. ```jsx ``` -------------------------------- ### Render Table with Columns and Rows Source: https://github.com/backstage/docs-ui/blob/main/components/table.html Example of rendering a table with a header row and mapping over items to display each item's name and owner in separate columns. ```tsx >Name >Owner >Type {items.map(item => ( ))} ``` -------------------------------- ### Menu with SubmenuTrigger and MenuItem Source: https://github.com/backstage/docs-ui/blob/main/components/menu/__next.components.menu.__PAGE__.txt Example showing a MenuTrigger with a Button, a Menu containing a MenuItem for 'New File', and a SubmenuTrigger with a nested Menu containing a MenuItem for 'File 1.txt'. ```jsx New File Open Recent File 1.txt ``` -------------------------------- ### Select with SelectItem and useAsyncList Source: https://github.com/backstage/docs-ui/blob/main/components/select/__next._full.txt Example of using Select and SelectItem from @backstage/ui. It shows a Select with a label 'Release channel' and items from a releaseChannels array, rendering a CustomReleaseChannel component for each channel. ```tsx import { Select, SelectItem } from '@backstage/ui'; ``` -------------------------------- ### Render Table with SearchField and columnConfig Source: https://github.com/backstage/docs-ui/blob/main/components/table.html Shows how to render a Table component with a SearchField and column configuration. The example includes a search state and spreads tableProps onto the Table. ```tsx return ( <> ); ``` -------------------------------- ### Menu with MenuTrigger and MenuButton Source: https://github.com/backstage/docs-ui/blob/main/components/menu.html Example showing a menu with a trigger button and menu items. Use when rendering a basic menu with a custom trigger. ```jsx New Open ``` -------------------------------- ### Select Component Basic Usage Source: https://github.com/backstage/docs-ui/blob/main/components/select/__next._full.txt Example of using the Select component with a name, label, and options prop. ```tsx
- ... - - +
``` -------------------------------- ### Table component with columnConfig and filter Source: https://github.com/backstage/docs-ui/blob/main/components/table.html Example of using the Table component with a columnConfig prop and a filter value, including an onChange handler that updates the filter type. ```tsx filter.onChange({ type: value || null }), }} /> ``` -------------------------------- ### Select with search and options Source: https://github.com/backstage/docs-ui/blob/main/components/select.txt Example of a Select component with a search placeholder and an options array containing font choices. ```jsx ``` -------------------------------- ### Table with custom cell renderer Source: https://github.com/backstage/docs-ui/blob/main/components/table.html Example of a Table component with a custom cell renderer for the 'owner' column, using CellText to display item.owner. ```tsx const { tableProps } = useTable({ columns: [ { title: 'Name', field: 'name', render: (item) => }, { title: 'Owner', field: 'owner', render: (item) => }, ], data: [...], }); function MyTable() { const { tableProps } = useTable({ columns: [ { title: 'Name', field: 'name', render: (item) => }, { title: 'Owner', field: 'owner', render: (item) => }, ], data: [...], }); return
; } ``` -------------------------------- ### Flex direction column example Source: https://github.com/backstage/docs-ui/blob/main/components/flex/__next.components.flex.__PAGE__.txt Example showing the Flex component with direction="column" and gap="2", containing two DecorativeBox children. ```jsx First Second ``` -------------------------------- ### CardHeader and CardFooter usage Source: https://github.com/backstage/docs-ui/blob/main/components/card.html Example showing the CardHeader and CardFooter components used inside a Card. The code is rendered with syntax highlighting. ```jsx HeaderFooter ```