@Tag(value="vaadin-accordion") @NpmPackage(value="@vaadin/vaadin-accordion", version="1.2.0") @JsModule(value="@vaadin/vaadin-accordion/src/vaadin-accordion.js") public class Accordion extends Component implements HasSize, HasStyle
| Modifier and Type | Class and Description |
|---|---|
static class |
Accordion.OpenedChangeEvent
An event fired when an Accordion is opened or closed.
|
| Constructor and Description |
|---|
Accordion() |
| Modifier and Type | Method and Description |
|---|---|
AccordionPanel |
add(AccordionPanel panel)
Adds a panel.
|
AccordionPanel |
add(String summary,
Component content)
Adds a panel created from the given title and content.
|
Registration |
addOpenedChangeListener(ComponentEventListener<Accordion.OpenedChangeEvent> listener)
Registers a listener to be notified whenever a panel is opened or closed.
|
void |
close()
Closes the opened panel (if any) in this accordion.
|
OptionalInt |
getOpenedIndex()
Gets the index of the currently opened index.
|
Optional<AccordionPanel> |
getOpenedPanel()
Gets the opened panel.
|
void |
open(AccordionPanel panel)
Opens the specified panel.
|
void |
open(int index)
Opens the panel at the specified index.
|
void |
remove(AccordionPanel panel)
Removes a panel.
|
void |
remove(Component content)
Removes a panel based on the content
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCssSize, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFulladdClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNamegetElementaddAttachListeneraddDetachListenerpublic AccordionPanel add(String summary, Component content)
summary - the title of the panelcontent - the content of th panelpublic AccordionPanel add(AccordionPanel panel)
panel - the non-null panel to be addedpublic void remove(AccordionPanel panel)
panel - the non-null panel to be removedpublic void remove(Component content)
content - the non-null content of the panel to be removedpublic void close()
public void open(int index)
index - the (positive) index of the panel to be open. The first panel
is at index zero.public void open(AccordionPanel panel)
panel - the non-null panel to be opened@Synchronize(property="opened", value="opened-changed") public OptionalInt getOpenedIndex()
@Synchronize(property="opened", value="opened-changed") public Optional<AccordionPanel> getOpenedPanel()
public Registration addOpenedChangeListener(ComponentEventListener<Accordion.OpenedChangeEvent> listener)
listener - the listener to be notifiedCopyright © 2025. All rights reserved.