Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions docs/5.x/docs/components/ConnectedButtonGroup/ConnectedButtonGroup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: ConnectedButtonGroup
---

import PropTable from '@docs/components/PropTable.tsx';
import ExtendsLink from '@docs/components/ExtendsLink.tsx';
import ThemeColorsTable from '@docs/components/ThemeColorsTable.tsx';
import ScreenshotTabs from '@docs/components/ScreenshotTabs.tsx';
import ExtendedExample from '@docs/components/ExtendedExample.tsx';

Connected button groups let people select from a set of related options, switch views or sort elements. They are the Material Design 3 successor to `SegmentedButtons`: selected buttons morph to a fully-rounded shape and the group supports single- and multi-select.

<ScreenshotTabs screenshotData="screenshots/connected-button-group.png" />

## Usage

```js
import * as React from 'react';
import { SafeAreaView, StyleSheet } from 'react-native';
import { ConnectedButtonGroup } from 'react-native-paper';

const MyComponent = () => {
const [value, setValue] = React.useState('walk');

return (
<SafeAreaView style={styles.container}>
<ConnectedButtonGroup
value={value}
onValueChange={setValue}
buttons={[
{ value: 'walk', label: 'Walking' },
{ value: 'train', label: 'Transit' },
{ value: 'drive', label: 'Driving' },
]}
/>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
},
});

export default MyComponent;
```

## Props

<span />

<div>

### buttons (required)

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="buttons" />

<div>

### size

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="size" />

<div>

### style

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="style" />

<div>

### testID

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="testID" />

<div>

### theme

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="theme" />

<span />

## Theme colors

<ThemeColorsTable
themeColorsData={{
checked: {
'-': {
backgroundColor: 'theme.colors.secondaryContainer',
textColor: 'theme.colors.onSecondaryContainer',
},
},
unchecked: {
'-': {
backgroundColor: 'theme.colors.surfaceContainer',
textColor: 'theme.colors.onSurfaceVariant',
},
},
disabled: {
'-': {
backgroundColor: 'theme.colors.onSurface',
textColor: 'theme.colors.onSurface',
},
},
}}
componentName="ConnectedButtonGroup"
/>

<span />
3 changes: 3 additions & 0 deletions docs/5.x/docs/components/ConnectedButtonGroup/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"ConnectedButtonGroup"
]
7 changes: 7 additions & 0 deletions docs/5.x/docs/components/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
"collapsible": true,
"collapsed": false
},
{
"type": "dir",
"name": "ConnectedButtonGroup",
"label": "ConnectedButtonGroup",
"collapsible": true,
"collapsed": false
},
{
"type": "dir",
"name": "DataTable",
Expand Down
112 changes: 112 additions & 0 deletions docs/6.x/docs/components/ConnectedButtonGroup/ConnectedButtonGroup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: ConnectedButtonGroup
---

import PropTable from '@docs/components/PropTable.tsx';
import ExtendsLink from '@docs/components/ExtendsLink.tsx';
import ThemeColorsTable from '@docs/components/ThemeColorsTable.tsx';
import ScreenshotTabs from '@docs/components/ScreenshotTabs.tsx';
import ExtendedExample from '@docs/components/ExtendedExample.tsx';

Connected button groups let people select from a set of related options,
switch views or sort elements. They are the Material Design 3 successor to
`SegmentedButtons`: selected buttons morph to a fully-rounded shape and the
group supports single- and multi-select.




<ScreenshotTabs screenshotData={"screenshots/connected-button-group.png"}/>


## Usage
```js
import * as React from 'react';
import { SafeAreaView, StyleSheet } from 'react-native';
import { ConnectedButtonGroup } from 'react-native-paper';

const MyComponent = () => {
const [value, setValue] = React.useState('walk');

return (
<SafeAreaView style={styles.container}>
<ConnectedButtonGroup
value={value}
onValueChange={setValue}
buttons={[
{ value: 'walk', label: 'Walking' },
{ value: 'train', label: 'Transit' },
{ value: 'drive', label: 'Driving' },
]}
/>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
},
});

export default MyComponent;
```


## Props
<span />



<div>

### buttons (required)

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="buttons" />

<div>

### size

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="size" />

<div>

### style

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="style" />

<div>

### testID

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="testID" />

<div>

### theme

</div>

<PropTable componentLink="ConnectedButtonGroup/ConnectedButtonGroup" prop="theme" />



<span />


## Theme colors

<ThemeColorsTable themeColorsData={{"checked":{"-":{"backgroundColor":"theme.colors.secondaryContainer","textColor":"theme.colors.onSecondaryContainer"}},"unchecked":{"-":{"backgroundColor":"theme.colors.surfaceContainer","textColor":"theme.colors.onSurfaceVariant"}},"disabled":{"-":{"backgroundColor":"theme.colors.onSurface","textColor":"theme.colors.onSurface"}}}} componentName="ConnectedButtonGroup" />


<span />
3 changes: 3 additions & 0 deletions docs/6.x/docs/components/ConnectedButtonGroup/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
"ConnectedButtonGroup"
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import ThemeColorsTable from '@docs/components/ThemeColorsTable.tsx';
import ScreenshotTabs from '@docs/components/ScreenshotTabs.tsx';
import ExtendedExample from '@docs/components/ExtendedExample.tsx';

@deprecated Segmented buttons are deprecated in the Material Design 3 spec
and replaced by the Connected Button Group. Use
[`ConnectedButtonGroup`](../ConnectedButtonGroup/ConnectedButtonGroup) instead — it exposes the
same single/multi-select API with `buttons`, `value` and `onValueChange`.

Segmented buttons can be used to select options, switch views or sort elements.


Expand Down
7 changes: 7 additions & 0 deletions docs/6.x/docs/components/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
"collapsible": true,
"collapsed": false
},
{
"type": "dir",
"name": "ConnectedButtonGroup",
"label": "ConnectedButtonGroup",
"collapsible": true,
"collapsed": false
},
{
"type": "dir",
"name": "DataTable",
Expand Down
3 changes: 3 additions & 0 deletions docs/component-docs.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const pages = {
Chip: {
Chip: 'Chip/Chip',
},
ConnectedButtonGroup: {
ConnectedButtonGroup: 'ConnectedButtonGroup/ConnectedButtonGroup',
},
DataTable: {
DataTable: 'DataTable/DataTable',
DataTableCell: 'DataTable/DataTableCell',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading