Giter VIP home page Giter VIP logo

ejbenke / spfx-react-accordion-section Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 7.0 988 KB

Collapsible Accordion Section that can be added to a page & easily populated with SharePoint List data based on List selected by user. Ideal for creating FAQs.

JavaScript 4.50% TypeScript 65.84% CSS 29.66%
accordion accordion-section accordion-widget faq faq-accordion faq-addon faqs javascript property-panel react reactjs sharepoint sharepoint-framework sharepoint-webpart spfx typescript webpart

spfx-react-accordion-section's People

Contributors

ejbenke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spfx-react-accordion-section's Issues

Set first AccordionItem preExpanded attribute to True

This is a great piece of code. I am a newbie in that language. I am trying to get the First item to be selected/preExpanded at loading. Not really getting anywhere with below

preExpanded: string[] [optional, default: []]
Accepts an array of strings and any AccordionItem whose uuid prop matches any one of these strings will be expanded on mount.

nor how to implement that piece of code I found while searching for an answer.

   <Accordion preExpanded={[placeholders[0].uuid]}>
        {placeholders.map((placeholder: Placeholder) => (
            <AccordionItem
                key={placeholder.heading}
                uuid={placeholder.uuid}
            >
                <AccordionItemHeading>
                    <AccordionItemButton>
                        {placeholder.heading}
                    </AccordionItemButton>
                </AccordionItemHeading>
                <AccordionItemPanel>{placeholder.panel}</AccordionItemPanel>
            </AccordionItem>
        ))}
    </Accordion>

I also found the AccordionItem class with the instanceUuid property

export default class AccordionItem extends React.Component {
static defaultProps: typeof defaultProps;
static displayName: DisplayName.AccordionItem;
instanceUuid: UUID;
renderChildren: (itemContext: ItemContext) => JSX.Element;
render(): JSX.Element;
}

As items/results is a zero based collection, would have thought that items(0).selected=true or items(0).preExpanded=True.

Could anyone point me into the right direction or provides the line of code? it is going to be so simple that I feel embarrassed to ask. Thanking you in advance

IE 11 Issue

Hey ejbenke,

I was having an issue getting this to work in our environment using IE11. I discovered that adding a few "references" fixes it. I added the following imports which seems to have resolved it:

import "core-js/es6/array";
import "es6-map/implement";
import "core-js/modules/es6.array.find";

Cheers!

Great sample!

@ejbenke this is a great sample. I've been looking for a good accordion SPFx sample.

Would you be interested in posting your sample on the aka.ms/spfx-webparts samples repository?

If you're interested, you can let me know via GitHub or @bernierh on Twitter and we can make it happen!

Thanks for sharing your awesome work!

SPO2019

Hi,

Apologies for using this as a contact channel (l hope it doesn't contravene community guidelines).

We would really like to use this web part. My first question is is it compatible with 365 SPO 2019. Secondly, unfortunately we have no developer expertise (we are a small UK College) and do not know how to install and deploy GitHub based web parts. Is there a "complete" version we can install ?

Again sorry for contacting you this way but any help would be deeply appreciated as this would be an excellent solution for us. I can provide contact details if helpful..

Thanks

Alan

Collapsible/Expandable Webpart Title

Hello,

Thank you for creating this code. It helps a lot with newbies like me just learning how to code. My questions is how to make the Accordion SharePoint Webpart Title be collapsible/expandable (I believe this might be called a Nested Accordion), so that all the sections under the Title are collapsed when the user lands on the SharePoint page?

Any guidance would be greatly appreciate.

Single Accordion with Multiple Collapsible Sections

Hi @ejbenke - Hope you are doing well. Thank you for your help on the Collapsible/Expandable Webpart Title last year which is working great.

I'm looking at having the accordion Webpart to be able to have a second subtitle to be entered to create multiple collapsible sections in the accordion. So it will have three levels where the first level is the Title, the second level to be another Title (subtitle), and the third level will pull the content from the SP list. Pictured below.

1

2

3

I tried several days to figure out the code but wasn't successfully.

Any help with this would be great.

Thank you for all your help and looking forward to hearing from you.

List Field Type

First off- thanks for makig this available!

What should the field type for 'Content' Be. I have tried Text field ('Rich text' and also 'Enhanced rich text'

When using 'Rich text' line breaks are not rendered for the client.
When using 'Enhanced rich text', the html is not rendered but displayed as part of the content.

I am using the code as provided and made no changes. Any guidance will be appreciated.

2020-07-03_14-01-27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.