Skip to content
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
13964d8
Implement InlineAlert component #1343
arumsey May 8, 2023
f8c9ae9
Implement InlineAlert component #1343
arumsey May 9, 2023
e8499bd
Merge branch 'main' into 1343-inline-alert
arumsey May 9, 2023
66bd61d
Implement InlineAlert component #1343
arumsey May 9, 2023
ef50ea6
Implement InlineAlert component #1343
arumsey May 9, 2023
5789cf2
Implement InlineAlert component #1343
arumsey May 9, 2023
66ba5ad
Implement InlineAlert component #1343
arumsey May 9, 2023
23bb3af
Implement InlineAlert component #1343
arumsey May 9, 2023
d051ead
Implement InlineAlert component #1343
arumsey May 9, 2023
a855f0d
Implement InlineAlert component #1343
arumsey May 9, 2023
49dd5d0
Implement InlineAlert component #1343
arumsey May 9, 2023
36b0440
Implement InlineAlert component #1343
arumsey May 9, 2023
fc3d934
Implement InlineAlert component #1343
arumsey May 9, 2023
ccfd78b
Implement InlineAlert component #1343
arumsey May 10, 2023
2344413
Implement InlineAlert component #1343
arumsey May 10, 2023
ae627d8
Implement InlineAlert component #1343
arumsey May 10, 2023
aeb85f5
Implement InlineAlert component #1343
arumsey May 16, 2023
25bed87
Merge branch 'main' into 1343-inline-alert
arumsey May 16, 2023
f2cff49
Implement InlineAlert component #1343
arumsey May 16, 2023
043863f
Implement InlineAlert component #1343
arumsey May 16, 2023
dc40919
add inline alert docs
reidbarber May 24, 2023
53f6177
Merge branch 'main' into docs-inline-alert
reidbarber May 25, 2023
7b12803
Merge branch 'main' into docs-inline-alert
reidbarber Jun 1, 2023
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
113 changes: 113 additions & 0 deletions packages/@react-spectrum/inlinealert/docs/InlineAlert.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{/* Copyright 2023 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License. */}

import {Layout} from '@react-spectrum/docs';
export default Layout;

import docs from 'docs:@react-spectrum/inlinealert';
import {HeaderInfo, PropTable, PageDescription} from '@react-spectrum/docs';
import packageData from '@react-spectrum/statuslight/package.json';

```jsx import
import {InlineAlert} from '@react-spectrum/inlinealert';
import {Header, Content} from '@adobe/react-spectrum';
```

---
category: Status
keywords: [inline alert, alert]
---

# InlineAlert

<PageDescription>{docs.exports.InlineAlert.description}</PageDescription>

<HeaderInfo
packageData={packageData}
componentNames={['InlineAlert']}
sourceData={[
{type: 'Spectrum', url: 'https://spectrum.adobe.com/page/in-line-alert/'}
]} />

## Example

```tsx example
<InlineAlert>
<Header>Payment Information</Header>
<Content>Enter your billing address, shipping address, and payment method to complete your purchase.</Content>
</InlineAlert>
```

## Content

Inline alerts contain a title and body. They also include an icon for non-neutral variants.

```tsx example
<InlineAlert variant="positive">
<Header>Payment Information</Header>
<Content>Enter your billing address, shipping address, and payment method to complete your purchase.</Content>
</InlineAlert>
```

### Accessibility

Inline alerts are given the [alert role](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/alert_role), which means they should only be used for information that requires the user's immediate attention.

### Internationalization

To internationalize an InlineAlert, localized strings should be set as the title and body content of the InlineAlert.
For languages that are read right-to-left (e.g. Hebrew and Arabic), the InlineAlert is automatically flipped.

## Props

<PropTable component={docs.exports.InlineAlert} links={docs.links} />

## Visual options

### Variant
[View guidelines](https://spectrum.adobe.com/page/in-line-alert/#Options)

When inline alerts have a semantic meaning, they should use the appropriate variant.
The default variant is neutral, and should be used when the message is neutral in tone or when its semantics do not fit any of the other variants.

#### Informative

```tsx example
<InlineAlert variant="info">
<Header>Accepted Payment Methods</Header>
<Content>Only major credit cards are accepted for payment. Direct debit is currently unavailable.</Content>
</InlineAlert>
```

#### Positive

```tsx example
<InlineAlert variant="positive">
<Header>Purchase completed</Header>
<Content>You'll get a confirmation email with your order details shortly.</Content>
</InlineAlert>
```

#### Notice

```tsx example
<InlineAlert variant="notice">
<Header>Update payment information</Header>
<Content>The saved credit card for your account has expired. Update your payment information to complete the purchase.</Content>
</InlineAlert>
```

#### Negative

```tsx example
<InlineAlert variant="negative">
<Header>Unable to process payment</Header>
<Content>There was an error processing your payment. Please check that your credit card information is correct, then try again.</Content>
</InlineAlert>
```