React bootstrap text

React bootstrap text DEFAULT

Alerts

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

Examples#

Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight s.

[

'primary',

'secondary',

'success',

'danger',

'warning',

'info',

'light',

'dark',

].map((variant, idx)=>(

<Alertkey={idx}variant={variant}>

This is a {variant} alert—check it out!

</Alert>

));

Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the class.

Links#

For links, use the component to provide matching colored links within any alert.

[

'primary',

'secondary',

'success',

'danger',

'warning',

'info',

'light',

'dark',

].map((variant, idx)=>(

<Alertkey={idx}variant={variant}>

This is a {variant} alert with{' '}

<Alert.Linkhref="#">an example link</Alert.Link>. Give it a click if you

like.

</Alert>

));

Additional content#

Alerts can contain whatever content you like. Headers, paragraphs, dividers, go crazy.

<Alertvariant="success">

<Alert.Heading>Hey, nice to see you</Alert.Heading>

<p>

Aww yeah, you successfully read this important alert message. This example

text is going to run a bit longer so that you can see how spacing within an

alert works withthis kind of content.

</p>

<hr/>

<pclassName="mb-0">

Whenever you need to, be sure to use margin utilities to keep things nice

and tidy.

</p>

</Alert>

Dismissing#

Add the prop to add a functioning dismiss button to the Alert.

functionAlertDismissibleExample(){

const[show, setShow]=useState(true);

if(show){

return(

<Alertvariant="danger"onClose={()=>setShow(false)}dismissible>

<Alert.Heading>Oh snap! You got an error!</Alert.Heading>

<p>

Change this and that and try again. Duis mollis, est non commodo

luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.

Cras mattis consectetur purus sit amet fermentum.

</p>

</Alert>

);

}

return<ButtononClick={()=>setShow(true)}>Show Alert</Button>;

}

render(<AlertDismissibleExample/>);

You can also control the visual state directly which is great if you want to build more complicated alerts.

functionAlertDismissible(){

const[show, setShow]=useState(true);

return(

<>

<Alertshow={show}variant="success">

<Alert.Heading>How's it going?!</Alert.Heading>

<p>

Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget

lacinia odio sem nec elit. Cras mattis consectetur purus sit amet

fermentum.

</p>

<hr/>

<divclassName="d-flex justify-content-end">

<ButtononClick={()=>setShow(false)}variant="outline-success">

Close me y'all!

</Button>

</div>

</Alert>

{!show &&<ButtononClick={()=>setShow(true)}>Show Alert</Button>}

</>

);

}

render(<AlertDismissible/>);

API#

Alert#view source file

Copy import code for the Alert component
NameTypeDefaultDescription
closeLabel

string

Sets the text for alert close button.

closeVariant

Sets the variant for close button.

dismissible

boolean

Renders a properly aligned dismiss button, as well as adding extra horizontal padding to the Alert.

onClose

function

controls

Callback fired when alert is closed.

show

boolean

controlled by: , initial prop:

Controls the visual state of the Alert.

transition

boolean | elementType

Animate the alert dismissal. Defaults to using animation or use to disable. A custom Transition can also be provided.

variant

'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'dark' | 'light'

The Alert visual variant

bsPrefix

string

Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.

Alert.Heading#view source file

Copy import code for the Alert component
NameTypeDefaultDescription
as

elementType

You can use a custom element type for this component.

bsPrefix required

string

Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.

Alert.Link#view source file

Copy import code for the Alert component
NameTypeDefaultDescription
as

elementType

You can use a custom element type for this component.

bsPrefix required

string

Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.

Sours: https://react-bootstrap.github.io/components/alerts/

Theming and customizing styles#

Generally, if you stick to the Bootstrap defined classes and variants, there isn't anything you need to do to use a custom theme with React-Bootstrap. It just works. But we also make coloring outside the lines easy to do.

New variants and sizes#

Custom variants and sizes should follow the pattern of the default bootstrap variants, and define css classes matching: . React bootstrap builds the component in a consistent way that you can rely on. For instance this custom Button.

<>

<styletype="text/css">

{`

.btn-flat{

background-color:purple;

color:white;

}

.btn-xxl{

padding:1rem1.5rem;

font-size:1.5rem;

}

`}

</style>

<Buttonvariant="flat"size="xxl">

flat button

</Button>

</>

Prefixing components#

In some cases you may need to change the base class "prefix" of one or more Components. You can control how a Component prefixes its classes locally by changing the prop. Or globally via the Component.

Changing prefixes is an escape hatch and generally shouldn't be used.

<>

{}

<ThemeProviderprefixes={{ btn:'my-btn'}}>

<Buttonvariant="primary">My Button</Button>

</ThemeProvider>{' '}

<ButtonbsPrefix="super-btn"variant="primary">

Super button

</Button>

</>

Sours: https://react-bootstrap.github.io/getting-started/theming/
  1. Keepsake fallen dress
  2. Cobra 22lr
  3. Laptop 3ghz

React Text - Bootstrap 4 & Material Design

React Bootstrap Text

React Bootstrap text utilities are a group of text modifiers which change text alignment, wrapping, letter capitalization, weight, and italics.


Text alignment

Easily realign text to components with text alignment classes.

Ambitioni dedisse scripsisse iudicaretur. Cras mattis iudicium purus sit amet fermentum. Donec sed odio operae, eu vulputate felis rhoncus. Praeterea iter est quasdam res quas ex communi. At nos hinc posthac, sitientis piros Afros. Petierunt uti sibi concilium totius Galliae in diem certam indicere. Cras mattis iudicium purus sit amet fermentum.

For left, right, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.

Left aligned text on all viewport sizes.

Center aligned text on all viewport sizes.

Right aligned text on all viewport sizes.

Left aligned text on viewports sized SM (small) or wider.

Left aligned text on viewports sized MD (medium) or wider.

Left aligned text on viewports sized LG (large) or wider.

Left aligned text on viewports sized XL (extra-large) or wider.


Text wrapping and overflow

Prevent text from wrapping with a class.

This text should overflow the parent.

For longer content, you can add a class to truncate the text with an ellipsis. Requires or .

Praeterea iter est quasdam res quas ex communi.

Praeterea iter est quasdam res quas ex communi.

Text transform

Transform text in components with text capitalization classes.

Lowercased text.

Uppercased text.

CapiTaliZed text.

Note how only changes the first letter of each word, leaving the case of any other letters unaffected.


Font weight and italics

Quickly change the weight (boldness) of text or italicize text.

Bold text.

Bolder weight text (relative to the parent element).

Normal weight text.

Light weight text.

Lighter weight text (relative to the parent element).

Italic text.


Monospace

Change a selection to our monospace font stack with .


Reset color

Reset a text or link’s color with , so that it inherits the color from its parent.

Muted text with a reset link.


Text decoration

Remove a text decoration with a class.

Non-underlined link
Sours: https://mdbootstrap.com/docs/react/utilities/text/
How to customize a bootstrap theme in react - ReactJS with Hooks - Code Student

Overlays#

A set of components for positioning beautiful overlays, tooltips, popovers, and anything else you need.

Overview#

Things to know about the React-Boostrap Overlay components.

  • Overlays rely on the third-party library Popper.js. It's included automatically with React-Bootstrap, but you should reference the API for more advanced use cases.
  • The and components do not position themselves. Instead the (or ) components, inject and props.
  • Tooltip expects specific props injected by the component
  • Tooltips for elements must be triggered on a wrapper element.

Overlay#

is the fundamental component for positioning and controlling tooltip visibility. It's a wrapper around Popper.js, that adds support for transitions, and visibility toggling.

Creating an Overlay#

Overlays consist of at least two elements, the "overlay", the element to be positioned, as well as a "target", the element the overlay is positioned in relation to. You can also also have an "arrow" element, like the tooltips and popovers, but that is optional. Be sure to check out the Popper documentation for more details about the injected props.

functionExample(){

const[show, setShow]=useState(false);

const target =useRef(null);

return(

<>

<Buttonvariant="danger"ref={target}onClick={()=>setShow(!show)}>

Click me to see

</Button>

<Overlaytarget={target.current}show={show}placement="right">

{({ placement, arrowProps, show: _show, popper,...props })=>(

<div

{...props}

style={{

backgroundColor:'rgba(255, 100, 100, 0.85)',

padding:'2px 10px',

color:'white',

borderRadius:3,

...props.style,

}}

>

Simple tooltip

</div>

)}

</Overlay>

</>

);

}

render(<Example/>);

OverlayTrigger#

Since the above pattern is pretty common, but verbose, we've included component to help with common use-cases. It even has functionality to delayed show or hides, and a few different "trigger" events you can mix and match.

Note that triggering components must be able to accept a ref since will attempt to add one. You can use forwardRef() for function components.

constrenderTooltip=(props)=>(

<Tooltipid="button-tooltip"{...props}>

Simple tooltip

</Tooltip>

);

render(

<OverlayTrigger

placement="right"

delay={{ show:250, hide:400}}

overlay={renderTooltip}

>

<Buttonvariant="success">Hover me to see</Button>

</OverlayTrigger>,

);

Customizing trigger behavior#

For more advanced behaviors accepts a function child that passes in the injected and event handlers that correspond to the configured prop.

You can manually apply the props to any element you want or split them up. The example below shows how to position the overlay to a different element than the one that triggers its visibility.

Pro Tip: Using the function form of OverlayTrigger avoids a call, for those trying to be strict mode compliant.

render(

<OverlayTrigger

placement="bottom"

overlay={<Tooltipid="button-tooltip-2">Check out this avatar</Tooltip>}

>

{({ ref,...triggerHandler })=>(

<Button

variant="light"

{...triggerHandler}

className="d-inline-flex align-items-center"

>

<Image

ref={ref}

roundedCircle

src="holder.js/20x20?text=J&bg=28a745&fg=FFF"

/>

<spanclassName="ms-1">Hover to see</span>

</Button>

)}

</OverlayTrigger>,

);

Tooltips#

A tooltip component for a more stylish alternative to that anchor tag attribute.

Examples#

Hover over the links below to see tooltips.

You can pass the injected props directly to the Tooltip component.

functionExample(){

const[show, setShow]=useState(false);

const target =useRef(null);

return(

<>

<Buttonref={target}onClick={()=>setShow(!show)}>

Click me!

</Button>

<Overlaytarget={target.current}show={show}placement="right">

{(props)=>(

<Tooltipid="overlay-example"{...props}>

My Tooltip

</Tooltip>

)}

</Overlay>

</>

);

}

render(<Example/>);

Or pass a Tooltip element to instead.

<>

{['top','right','bottom','left'].map((placement)=>(

<OverlayTrigger

key={placement}

placement={placement}

overlay={

<Tooltipid={`tooltip-${placement}`}>

Tooltip on <strong>{placement}</strong>.

</Tooltip>

}

>

<Buttonvariant="secondary">Tooltip on {placement}</Button>

</OverlayTrigger>

))}

</>

Popovers#

A popover component, like those found in iOS.

Examples#

const popover =(

<Popoverid="popover-basic">

<Popover.Headeras="h3">Popover right</Popover.Header>

<Popover.Body>

And here's some <strong>amazing</strong> content. It's very engaging.

right?

</Popover.Body>

</Popover>

);

constExample=()=>(

<OverlayTriggertrigger="click"placement="right"overlay={popover}>

<Buttonvariant="success">Click me to see</Button>

</OverlayTrigger>

);

render(<Example/>);

As with s, you can control the placement of the Popover.

<>

{['top','right','bottom','left'].map((placement)=>(

<OverlayTrigger

trigger="click"

key={placement}

placement={placement}

overlay={

<Popoverid={`popover-positioned-${placement}`}>

<Popover.Headeras="h3">{`Popover ${placement}`}</Popover.Header>

<Popover.Body>

<strong>Holy guacamole!</strong> Check this info.

</Popover.Body>

</Popover>

}

>

<Buttonvariant="secondary">Popover on {placement}</Button>

</OverlayTrigger>

))}

</>

Disabled elements#

Elements with the attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you’ll want to trigger the overlay from a wrapper or and override the on the disabled element.

<OverlayTriggeroverlay={<Tooltipid="tooltip-disabled">Tooltip!</Tooltip>}>

<spanclassName="d-inline-block">

<Buttondisabledstyle={{ pointerEvents:'none'}}>

Disabled button

</Button>

</span>

</OverlayTrigger>

Changing containers#

You can specify a to control the DOM element the overlay is appended to. This is especially useful when styles conflict with your Overlay's.

functionExample(){

const[show, setShow]=useState(false);

const[target, setTarget]=useState(null);

const ref =useRef(null);

consthandleClick=(event)=>{

setShow(!show);

setTarget(event.target);

};

return(

<divref={ref}>

<ButtononClick={handleClick}>Holy guacamole!</Button>

<Overlay

show={show}

target={target}

placement="bottom"

container={ref}

containerPadding={20}

>

<Popoverid="popover-contained">

<Popover.Headeras="h3">Popover bottom</Popover.Header>

<Popover.Body>

<strong>Holy guacamole!</strong> Check this info.

</Popover.Body>

</Popover>

</Overlay>

</div>

);

}

render(<Example/>);

Updating position dynamically#

Since we can't know every time your overlay changes size, to reposition it, you need to take manual action if you want to update the position of an Overlay in response to a change.

For this, the Overlay component also injects a a prop with a method that an overlay component can use to reposition itself.

const UpdatingPopover = React.forwardRef(

({ popper, children, show: _,...props }, ref)=>{

useEffect(()=>{

console.log('updating!');

popper.scheduleUpdate();

},[children, popper]);

return(

<Popoverref={ref}body{...props}>

{children}

</Popover>

);

},

);

const longContent =`

Very long

Multiline content

that is engaging and what-not

`;

const shortContent ='Short and sweet!';

functionExample(){

const[content, setContent]=useState(shortContent);

useEffect(()=>{

const timerId =setInterval(()=>{

setContent(content === shortContent ? longContent : shortContent);

},3000);

return()=>clearInterval(timerId);

});

return(

<OverlayTrigger

trigger="click"

overlay={

<UpdatingPopoverid="popover-contained">{content}</UpdatingPopover>

}

>

<Button>Holy guacamole!</Button>

</OverlayTrigger>

);

}

render(<Example/>);

API#

Overlay#view source file

Copy import code for the Overlay component
NameTypeDefaultDescription
container

componentOrElement | function

A component instance, DOM node, or function that returns either. The element will have the Overlay appended to it via a React portal.

onEnter

function

Callback fired before the Overlay transitions in

onEntered
Sours: https://react-bootstrap.github.io/components/overlays/

Text react bootstrap

Toasts

functionExample(){

const[showA, setShowA]=useState(true);

const[showB, setShowB]=useState(true);

consttoggleShowA=()=>setShowA(!showA);

consttoggleShowB=()=>setShowB(!showB);

return(

<Row>

<Colmd={6}className="mb-2">

<ButtononClick={toggleShowA}className="mb-2">

Toggle Toast <strong>with</strong> Animation

</Button>

<Toastshow={showA}onClose={toggleShowA}>

<Toast.Header>

<img

src="holder.js/20x20?text=%20"

className="rounded me-2"

alt=""

/>

<strongclassName="me-auto">Bootstrap</strong>

<small>11 mins ago</small>

</Toast.Header>

<Toast.Body>Woohoo, you're reading this text in a Toast!</Toast.Body>

</Toast>

</Col>

<Colmd={6}className="mb-2">

<ButtononClick={toggleShowB}className="mb-2">

Toggle Toast <strong>without</strong> Animation

</Button>

<ToastonClose={toggleShowB}show={showB}animation={false}>

<Toast.Header>

<img

src="holder.js/20x20?text=%20"

className="rounded me-2"

alt=""

/>

<strongclassName="me-auto">Bootstrap</strong>

<small>11 mins ago</small>

</Toast.Header>

<Toast.Body>Woohoo, you're reading this text in a Toast!</Toast.Body>

</Toast>

</Col>

</Row>

);

}

render(<Example/>);

Sours: https://react-bootstrap.github.io/components/toasts/
Dynamically Create Input Fields in React, Using React-Hooks and React-Bootstrap.

Cards

Bootstrap’s cards provide a flexible and extensible content container with multiple variants and options.

Basic Example#

<Cardstyle={{ width:'18rem'}}>

<Card.Imgvariant="top"src="holder.js/100px180"/>

<Card.Body>

<Card.Title>Card Title</Card.Title>

<Card.Text>

Some quick example text to build on the card title and make up the bulk of

the card's content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

</Card>

Content types#

Body#

Use to pad content inside a .

<Card>

<Card.Body>This is some text within a card body.</Card.Body>

</Card>

Alternatively, you can use this shorthand version for Cards with body only, and no other children

<Cardbody>This is some text within a card body.</Card>

Title, text, and links#

Using , , and inside the will line them up nicely. s are used to line up links next to each other.

outputs tags around the content, so you can use multiple s to create separate paragraphs.

<Cardstyle={{ width:'18rem'}}>

<Card.Body>

<Card.Title>Card Title</Card.Title>

<Card.SubtitleclassName="mb-2 text-muted">Card Subtitle</Card.Subtitle>

<Card.Text>

Some quick example text to build on the card title and make up the bulk of

the card's content.

</Card.Text>

<Card.Linkhref="#">Card Link</Card.Link>

<Card.Linkhref="#">Another Link</Card.Link>

</Card.Body>

</Card>

List Groups#

Create lists of content in a card with a flush list group.

<Cardstyle={{ width:'18rem'}}>

<ListGroupvariant="flush">

<ListGroup.Item>Cras justo odio</ListGroup.Item>

<ListGroup.Item>Dapibus ac facilisis in</ListGroup.Item>

<ListGroup.Item>Vestibulum at eros</ListGroup.Item>

</ListGroup>

</Card>

<Cardstyle={{ width:'18rem'}}>

<Card.Header>Featured</Card.Header>

<ListGroupvariant="flush">

<ListGroup.Item>Cras justo odio</ListGroup.Item>

<ListGroup.Item>Dapibus ac facilisis in</ListGroup.Item>

<ListGroup.Item>Vestibulum at eros</ListGroup.Item>

</ListGroup>

</Card>

Kitchen Sink#

<Cardstyle={{ width:'18rem'}}>

<Card.Imgvariant="top"src="holder.js/100px180?text=Image cap"/>

<Card.Body>

<Card.Title>Card Title</Card.Title>

<Card.Text>

Some quick example text to build on the card title and make up the bulk of

the card's content.

</Card.Text>

</Card.Body>

<ListGroupclassName="list-group-flush">

<ListGroupItem>Cras justo odio</ListGroupItem>

<ListGroupItem>Dapibus ac facilisis in</ListGroupItem>

<ListGroupItem>Vestibulum at eros</ListGroupItem>

</ListGroup>

<Card.Body>

<Card.Linkhref="#">Card Link</Card.Link>

<Card.Linkhref="#">Another Link</Card.Link>

</Card.Body>

</Card>

Header and Footer#

You may add a header by adding a component.

<Card>

<Card.Header>Featured</Card.Header>

<Card.Body>

<Card.Title>Special title treatment</Card.Title>

<Card.Text>

With supporting text below as a natural lead-in to additional content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

</Card>

A can be styled by passing a heading element through the prop

<Card>

<Card.Headeras="h5">Featured</Card.Header>

<Card.Body>

<Card.Title>Special title treatment</Card.Title>

<Card.Text>

With supporting text below as a natural lead-in to additional content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

</Card>

<Card>

<Card.Header>Quote</Card.Header>

<Card.Body>

<blockquoteclassName="blockquote mb-0">

<p>

{' '}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere

erat a ante.{' '}

</p>

<footerclassName="blockquote-footer">

Someone famous in<citetitle="Source Title">Source Title</cite>

</footer>

</blockquote>

</Card.Body>

</Card>

<CardclassName="text-center">

<Card.Header>Featured</Card.Header>

<Card.Body>

<Card.Title>Special title treatment</Card.Title>

<Card.Text>

With supporting text below as a natural lead-in to additional content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

<Card.FooterclassName="text-muted">2 days ago</Card.Footer>

</Card>

Images#

Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding the image in a card.

Image caps#

Similar to headers and footers, cards can include top and bottom “image caps”—images at the top or bottom of a card.

<>

<Card>

<Card.Imgvariant="top"src="holder.js/100px180"/>

<Card.Body>

<Card.Text>

Some quick example text to build on the card title and make up the bulk

of the card's content.

</Card.Text>

</Card.Body>

</Card>

<br/>

<Card>

<Card.Body>

<Card.Text>

Some quick example text to build on the card title and make up the bulk

of the card's content.

</Card.Text>

</Card.Body>

<Card.Imgvariant="bottom"src="holder.js/100px180"/>

</Card>

</>

Image Overlays#

Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need additional styles or utilities.

<CardclassName="bg-dark text-white">

<Card.Imgsrc="holder.js/100px270"alt="Card image"/>

<Card.ImgOverlay>

<Card.Title>Card title</Card.Title>

<Card.Text>

This is a wider card with supporting text below as a natural lead-in to

additional content. This content is a little bit longer.

</Card.Text>

<Card.Text>Last updated 3 mins ago</Card.Text>

</Card.ImgOverlay>

</Card>

Navigation#

Add some navigation to a card’s header (or block) with React Bootstrap’s Nav components.

<Card>

<Card.Header>

<Navvariant="tabs"defaultActiveKey="#first">

<Nav.Item>

<Nav.Linkhref="#first">Active</Nav.Link>

</Nav.Item>

<Nav.Item>

<Nav.Linkhref="#link">Link</Nav.Link>

</Nav.Item>

<Nav.Item>

<Nav.Linkhref="#disabled"disabled>

Disabled

</Nav.Link>

</Nav.Item>

</Nav>

</Card.Header>

<Card.Body>

<Card.Title>Special title treatment</Card.Title>

<Card.Text>

With supporting text below as a natural lead-in to additional content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

</Card>

<Card>

<Card.Header>

<Navvariant="pills"defaultActiveKey="#first">

<Nav.Item>

<Nav.Linkhref="#first">Active</Nav.Link>

</Nav.Item>

<Nav.Item>

<Nav.Linkhref="#link">Link</Nav.Link>

</Nav.Item>

<Nav.Item>

<Nav.Linkhref="#disabled"disabled>

Disabled

</Nav.Link>

</Nav.Item>

</Nav>

</Card.Header>

<Card.Body>

<Card.Title>Special title treatment</Card.Title>

<Card.Text>

With supporting text below as a natural lead-in to additional content.

</Card.Text>

<Buttonvariant="primary">Go somewhere</Button>

</Card.Body>

</Card>

Card Styles#

Background Color#

You can change a card's appearance by changing their , and props.

[

'Primary',

'Secondary',

'Success',

'Danger',

'Warning',

'Info',

'Light',

'Dark',

].map((variant, idx)=>(

<Card

bg={variant.toLowerCase()}

key={idx}

text={variant.toLowerCase()==='light'?'dark':'white'}

style={{ width:'18rem'}}

className="mb-2"

>

<Card.Header>Header</Card.Header>

<Card.Body>

<Card.Title>{variant} Card Title </Card.Title>

<

Sours: https://react-bootstrap.github.io/components/cards/

Similar news:

Buttons

functionToggleButtonExample(){

const[checked, setChecked]=useState(false);

const[radioValue, setRadioValue]=useState('1');

const radios =[

{ name:'Active', value:'1'},

{ name:'Radio', value:'2'},

{ name:'Radio', value:'3'},

];

return(

<>

<ButtonGroupclassName="mb-2">

<ToggleButton

id="toggle-check"

type="checkbox"

variant="secondary"

checked={checked}

value="1"

onChange={(e)=>setChecked(e.currentTarget.checked)}

>

Checked

</ToggleButton>

</ButtonGroup>

<br/>

<ButtonGroupclassName="mb-2">

{radios.map((radio, idx)=>(

<ToggleButton

key={idx}

id={`radio-${idx}`}

type="radio"

variant="secondary"

name="radio"

value={radio.value}

checked={radioValue === radio.value}

onChange={(e)=>setRadioValue(e.currentTarget.value)}

>

{radio.name}

</ToggleButton>

))}

</ButtonGroup>

<br/>

<ToggleButton

className="mb-2"

id="toggle-check"

type="checkbox"

variant="outline-primary"

checked={checked}

value="1"

onChange={(e)=>setChecked(e.currentTarget.checked)}

>

Checked

</ToggleButton>

<br/>

<ButtonGroup>

{radios.map((radio, idx)=>(

<ToggleButton

key={idx}

id={`radio-${idx}`}

type="radio"

variant={idx %2?'outline-success':'outline-danger'}

name="radio"

value={radio.value}

checked={radioValue === radio.value}

onChange={(e)=>setRadioValue(e.currentTarget.value)}

>

{radio.name}

</ToggleButton>

))}

</ButtonGroup>

</>

);

}

render(<ToggleButtonExample/>);

Sours: https://react-bootstrap.github.io/components/buttons/


1281 1282 1283 1284 1285