Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(Offcanvas): add top placement (#5847)
  • Loading branch information
ken604 committed May 28, 2021
1 parent e87e2ba commit 82fe23f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Offcanvas.tsx
Expand Up @@ -19,7 +19,7 @@ import OffcanvasTitle from './OffcanvasTitle';
import { BsPrefixRefForwardingComponent } from './helpers';
import { useBootstrapPrefix } from './ThemeProvider';

export type OffcanvasPlacement = 'start' | 'end' | 'bottom';
export type OffcanvasPlacement = 'start' | 'end' | 'top' | 'bottom';

export interface OffcanvasProps
extends Omit<
Expand Down Expand Up @@ -66,7 +66,12 @@ const propTypes = {
/**
* Which side of the viewport the offcanvas will appear from.
*/
placement: PropTypes.oneOf<OffcanvasPlacement>(['start', 'end', 'bottom']),
placement: PropTypes.oneOf<OffcanvasPlacement>([
'start',
'end',
'top',
'bottom',
]),

/**
* When `true` The offcanvas will automatically shift focus to itself when it
Expand Down
2 changes: 1 addition & 1 deletion www/src/examples/Offcanvas/Placement.js
Expand Up @@ -25,7 +25,7 @@ function OffCanvasExample({ name, ...props }) {
function Example() {
return (
<>
{['start', 'end', 'bottom'].map((placement, idx) => (
{['start', 'end', 'top', 'bottom'].map((placement, idx) => (
<OffCanvasExample key={idx} placement={placement} name={placement} />
))}
</>
Expand Down
1 change: 1 addition & 0 deletions www/src/pages/components/offcanvas.mdx
Expand Up @@ -30,6 +30,7 @@ actions whenever possible, or provide an explicit dismiss action.
Offcanvas supports a few different placements:
- `start` places offcanvas on the left of the viewport
- `end` places offcanvas on the right of the viewport
- `top` places offcanvas on the top of the viewport
- `bottom` places offcanvas on the bottom of the viewport

<ReactPlayground codeText={Placement} />
Expand Down

0 comments on commit 82fe23f

Please sign in to comment.