I currently try to figure out what would be the best way to "extend" a custom component or native element in Angular and wrap it with some custom markup? This is something I did quite often in React and which was quite forward. It could look like this:
type PasswordProps = {
label: string;
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>;
export const Password: FC<PasswordProps> = ({ label, ...inputProps }) => {
const id = useId();
return (
<>
<label htmlFor={id}>{label}</label>
<input name={id} type="password" {...inputProps} />
</>
);
};
I basically want specialized versions of existing components/elements and/or want to add some custom behavior. But I also want to "pass through" anything I don't touch.