Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 745a63d

Browse files
committedMar 10, 2025·
fix(snackbar): add width prop for snackbar
1 parent 2fbd3e2 commit 745a63d

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed
 

‎packages/core-components/src/components/snackbar/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
| `opened` | `opened` | Whether the snackbar is currently visible. Set to true to display the snackbar. | `boolean` | `false` |
1717
| `timed` | `timed` | Whether snackbar is show for limited time. Default is true. Error snackbars cannot be timed. | `boolean` | `true` |
1818
| `type` | `type` | The type of snackbar. Default is info. | `"error" \| "info" \| "success" \| "warning"` | `'info'` |
19-
| `width` | `width` | Width of the snackbar in px, Default value is 270px* | `string` | `'270px'` |
19+
| `width` | `width` | Width of the snackbar in px, Default value is 270px. | `string` | `'270px'` |
2020

2121

2222
## Events

‎packages/core-components/src/components/snackbar/snackbar.docs.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ If you set `timed` as true, using this property you can define the interval afte
3838

3939
_Note_: when user hovers over the snackbar, timeout is paused and resumes once the mouse leaves.
4040

41+
### Width
42+
43+
This property allow you to set the snackbar width. Minimum is 270px, maximum is 1000px. By default snackbar will have a width of 270px.
44+
4145
### Action
4246

4347
If you want your snackbar to have an action button, set `hasAction` to true. By default, it is false.

‎packages/core-components/src/components/snackbar/snackbar.scss

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
line-height: var(--b2b-size-copy-line-height-100);
88
color: var(--b2b-color-copy-default);
99
max-width: 1000px;
10+
min-width: 270px;
1011
max-height: 56px;
1112
min-height: 48px;
1213
box-shadow: 0 var(--b2b-size-1) var(--b2b-size-10) 0 #00000040;

‎packages/core-components/src/components/snackbar/snackbar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class SnackbarComponent {
141141
[`b2b-snackbar--${this.type}`]: true,
142142
'b2b-snackbar--opened': this.opened,
143143
}}
144-
style={{ minWidth: this.width }}>
144+
style={{ width: this.width }}>
145145
<div class="b2b-snackbar__content">
146146
<span class={{ [`b2b-snackbar--${this.type}__icon`]: true }}>
147147
{this.chooseIcon()}

0 commit comments

Comments
 (0)
Please sign in to comment.