Use Subset of fields in HumanNameInput React compo...
# support
m
So the HumanNameInput medplum component shows an option to select the "type" of name -- while I appreciate the direct alignment to FHIR standards, having a bunch of options when we don't need them for our application is just extra cognitive load. For example, I don't see a lot of value in a "temp" name, though I guess some use case uses it, but I don't need that as an option when someone is entering a new patient. I am thinking if I look at the medplum component code I suspect I could shove a display: none and a default value for that "use" field to get what I want... but is that the best approach for it? It feels like one might not always need to get every bit of info when getting HumanNameInput.... maybe there should be a prop to set which fields are displayed for input and it defaults to all of them? Is there an easier way to customize this than I am thinking?
Looks like similar feedback about the address component.
Also in support of more flexibility in components for getting a HumanName - from the fhir spec - "Contact persons need to be identified by name, but it is uncommon to need details about multiple other names for that contact person." So if I am looking to get a contact person name, there isn't a need for so much flexibility on the name types for input purposes I believe?
r
Hi @mik401 ! The short answer to your question is: yes. Adding props to the component would be the right way to go to update the component. The longer answer is: this is part of a larger React API design conversation. The use case you describe is needed not only for
HumanNameInput
and
AddressInput
, but also resource-level components such as
ResourceTable
and
ResourceForm
. We'd like to make all of these more customizable, while still maintaining a simple props API.
Would love your feedback on a unified approach we could take. Some questions that are been bugging me: - How does a developer specify which
HumanNameInput
fields they want to use, when they are utilizing a top-level component like
ResourceForm
? - What if the component chooses to omit a "required" element. Should that be allowed?